Пример #1
0
    def test_setup_creates_file_sync_operations_queue(self):
        files = {
            './LICENSE': 'remote/target/folder/',
            './README.md': 'remote/target/path/README.md'}

        sr = SshRemote({'files': files})
        sr.setup()
        self.assertEqual(sr._operations, files)
Пример #2
0
 def test_setup_fails_to_connect_without_password(self):
     sr = SshRemote({'hostname': 'localhost', 'username': '******'})
     sr.setup()
     self.assertEqual(sr.ip, '127.0.0.1')
     if paramiko:
         self.assertIsNotNone(sr.client)
     else:
         self.assertIsNone(sr.client)
     self.assertFalse(sr.connected)
Пример #3
0
    def test_setup_expands_glob_patterns_into_multiple_file_operations(self):
        files = {
            './LICENSE': 'remote/target/folder/',
            './README.md': 'remote/target/path/README.md'}

        sr = SshRemote({'files': {'./tests/test_*.py': 'remote/folder/'}})
        sr.setup()
        a = sr._operations.keys()
        a.sort()
        b = glob('./tests/test_*.py')
        b.sort()
        self.assertEqual(a,b)
Пример #4
0
 def test___init__(self):
     sr = SshRemote({'hostname': 'host.name', 'password': '******'})
     self.assertEqual(sr.hostname, 'host.name')
     self.assertIsNone(sr.ip)
     self.assertIsNone(sr.username)
     self.assertEqual(sr.password, 'abc123')
     self.assertFalse(sr.connected)
     self.assertIsNone(sr.client)
     self.assertEqual(sr._operations, {})
     self.assertIsNone(sr.event_manager)
Пример #5
0
    def test_update_fails_to_process_operations_without_connection(self):
        files = {
            './LICENSE': 'remote/target/folder/',
            './README.md': 'remote/target/path/README.md'}

        sr = SshRemote({'verbose': True, 'files': files})
        sr.setup()
        self.assertEqual(len(sr._operations), 2)
        self.assertFalse(sr.isDone())
        sr.update()
        self.assertEqual(len(sr._operations), 2)
Пример #6
0
 def test_destroy(self):
     sr = SshRemote({'hostname': 'localhost', 'username': '******', 'password': '******'})
     sr.setup(EventManager())
     sr.destroy()
     self.assertIsNone(sr.ip)
     self.assertFalse(sr.connected)
     self.assertIsNone(sr.client)
     self.assertIsNone(sr.event_manager)
Пример #7
0
 def test_setup_creates_empty_file_sync_operations_queue_by_default(self):
     sr = SshRemote()
     sr.setup()
     self.assertEqual(sr._operations, {})
Пример #8
0
 def test_setup_takes_event_manager(self):
     sr = SshRemote()
     em = EventManager()
     sr.setup(em)
     self.assertEqual(sr.event_manager, em)