Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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')
Exemplo n.º 3
0
 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)