1# Copyright 2014 Christoph Reiter
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7
8from senf import fsnative
9
10from tests import TestCase
11
12from quodlibet.formats.remote import RemoteFile
13
14
15class TRemoteFile(TestCase):
16
17    def test_path_types(self):
18        f = RemoteFile("http://example.com")
19        self.assertTrue(isinstance(f["~mountpoint"], fsnative))
20        self.assertTrue(isinstance(f["~filename"], fsnative))
21
22    def test_fix_old_types(self):
23        f = RemoteFile("http://example.com")
24        dict.__setitem__(f, "~filename", b"foo")
25        self.assertTrue(isinstance(f["~filename"], fsnative))
26        dict.__setitem__(f, "~filename", u"foo")
27        self.assertTrue(isinstance(f["~filename"], fsnative))
28