示例#1
0
    def test_BaseClient_newpath(self):
        '''Test BaseClient.newpath()'''
        bc = BaseClient(uri.format(path='path'))
        self.assertEqual(bc.getpath(), BasePath(uri.format(path='path')))

        self.assertEqual(bc.getpath('alternative/path'),
                         BasePath(uri.format(path='alternative/path')))
示例#2
0
    def test_BaseClient___init__(self):
        '''Test BaseClient()'''
        bc = BaseClient(uri.format(path='path'))
        self.assertEqual(bc.username, 'test')
        self.assertEqual(bc.password, 'pass')
        self.assertEqual(bc.hostname, 'localhost')
        self.assertEqual(bc.port, 63197)
        self.assertEqual(bc.path, 'path')
        self.assertEqual(bc.netloc, 'test:pass@localhost:63197')
        self.assertEqual(bc.query, 'testing=true&stuff=hello%20world&a=null')
        self.assertEqual(bc.testing, True)
        self.assertEqual(bc.stuff, 'hello world')
        self.assertEqual(bc.a, None)

        bc = BaseClient(uri.format(path='path') + '&path=/to/somewhere/else',
                        testing=False,
                        path='alternative/path')
        self.assertEqual(bc.testing, False)
        self.assertEqual(bc.path, 'alternative/path')
        self.assertEqual(getattr(bc, 'path_', None), '/to/somewhere/else')
示例#3
0
 def test_BaseClient_unlink(self):
     '''Test BaseClient.unline()'''
     with self.assertRaises(NotImplementedError):
         BaseClient('https://localhost').unlink()
示例#4
0
 def test_BaseClient_rename(self):
     '''Test BaseClient.rename()'''
     with self.assertRaises(NotImplementedError):
         BaseClient('https://localhost').rename()
示例#5
0
 def test_BaseClient_lchmod(self):
     '''Test BaseClient.lchmod()'''
     with self.assertRaises(NotImplementedError):
         BaseClient('https://localhost').lchmod('path', 0o777)
示例#6
0
 def test_BaseClient_chmod(self):
     with self.assertRaises(NotImplementedError):
         BaseClient('https://localhost').chmod('path', 0o777)
示例#7
0
 def test_BaseClient_scandir(self):
     '''Test BaseClient.scandir()'''
     with self.assertRaises(NotImplementedError):
         BaseClient('https://localhost').scandir()
示例#8
0
 def test_BaseClient_open(self):
     '''Test BaseClient.open()'''
     with self.assertRaises(NotImplementedError):
         BaseClient('').open('path')
示例#9
0
 def test_BaseClient_makedirs(self):
     '''Test BaseClient.makedirs()'''
     with self.assertRaises(NotImplementedError):
         BaseClient('https://localhost').makedirs()