def test_fetch(self): mock = MockDevice() with self.assertRaises(ValueError): mock.fetch('foo', 'not-likely-to-be-a-directory') mock.fetch('remote-path', '/tmp') self.assertIn(' '.join( mock.get_ssh_cmd(['scp', '[::1]:remote-path', '/tmp'])), mock.history) mock.fetch('corpus/*', '/tmp') self.assertIn(' '.join(mock.get_ssh_cmd(['scp', '[::1]:corpus/*', '/tmp'])), mock.history)
def test_fetch(self): mock = MockDevice() with self.assertRaises(ValueError): mock.fetch('foo', 'not-likely-to-be-a-directory') mock.fetch('remote-path', '/tmp') self.assertEqual( mock.last, 'scp -F ' + mock.host.ssh_config + ' [::1]:remote-path /tmp') mock.fetch('corpus/*', '/tmp') self.assertEqual(mock.last, 'scp -F ' + mock.host.ssh_config + ' [::1]:corpus/* /tmp')
def test_fetch(self): mock = MockDevice() with self.assertRaises(ValueError): mock.fetch('foo', 'not-likely-to-be-a-directory') mock.fetch('remote-path', '/tmp') self.assertIn( ' '.join(mock.get_ssh_cmd(['scp', '[::1]:remote-path', '/tmp'])), mock.host.history) mock.fetch('corpus/*', '/tmp') self.assertIn( ' '.join(mock.get_ssh_cmd(['scp', '[::1]:corpus/*', '/tmp'])), mock.host.history) mock.delay = 2 with self.assertRaises(subprocess.CalledProcessError): mock.fetch('delayed', '/tmp') mock.delay = 2 with self.assertRaises(subprocess.CalledProcessError): mock.fetch('delayed', '/tmp', retries=1) mock.delay = 2 mock.fetch('delayed', '/tmp', retries=2) self.assertIn( ' '.join(mock.get_ssh_cmd(['scp', '[::1]:delayed', '/tmp'])), mock.host.history)