Esempio n. 1
0
 def test_ssh_get(self, run_cmd):
     ssh_get('user@remote', 'foo/bar*', 'mydestdir')
     run_cmd.assert_called_with(['scp',
                                 '-q',
                                 '-oStrictHostKeyChecking=no',
                                 '-oUserKnownHostsFile=/dev/null',
                                 'user@remote:foo/bar*', '.'], cwd='mydestdir')
Esempio n. 2
0
 def test_ssh_run_cmd_with_remote_cwd(self, run_cmd):
     ssh_run_cmd('user@remote', ['touch', '"#'], remote_cwd='workspace')
     run_cmd.assert_called_with(['ssh',
                                 '-q',
                                 '-oStrictHostKeyChecking=no',
                                 '-oUserKnownHostsFile=/dev/null',
                                 'user@remote',
                                 'mkdir -p workspace ; cd workspace ; touch \'"#\''])
Esempio n. 3
0
 def test_ssh_run_cmd(self, run_cmd):
     ssh_run_cmd('user@remote', ['touch', '"#'])
     run_cmd.assert_called_with(['ssh',
                                 '-q',
                                 '-oStrictHostKeyChecking=no',
                                 '-oUserKnownHostsFile=/dev/null',
                                 'user@remote',
                                 'touch \'"#\''])
Esempio n. 4
0
 def test_poll_changes(self, run_cmd):
     run_cmd.return_value = b'cdf46dc0-a49c-11e5-b00a-c712eaff3d7c	refs/heads/master\n'
     ps = PackageSource.objects.get(id=1)
     self.assertTrue(ps.poll())
     run_cmd.assert_called_with([
         'git', 'ls-remote', 'https://github.com/eric/project0',
         'refs/heads/master'
     ])
Esempio n. 5
0
 def test_poll_fails(self, run_cmd):
     run_cmd.side_effect = CommandFailed("['git', 'ls-remote', u'https://github.com/eric/project0', u'refs/heads/master'] "
                                         "returned 128. Output: fatal: could not read Username for 'https://github.com': "
                                         "No such device or address\n",
                                         ['git', 'ls-remote', u'https://github.com/eric/project0', u'refs/heads/master'], 128,
                                         "fatal: could not read Username for 'https://github.com': No such device or address\n")
     ps = PackageSource.objects.get(id=1)
     self.assertFalse(ps.poll())
     run_cmd.assert_called_with(['git', 'ls-remote', 'https://github.com/eric/project0', 'refs/heads/master'])
     self.assertTrue(ps.disabled)
     self.assertTrue(ps.last_failure_time)
     self.assertEquals(ps.last_failure, "fatal: could not read Username for 'https://github.com': No such device or address\n")
Esempio n. 6
0
 def test_poll_fails(self, run_cmd):
     run_cmd.side_effect = CommandFailed(
         "['git', 'ls-remote', u'https://github.com/eric/project0', u'refs/heads/master'] "
         "returned 128. Output: fatal: could not read Username for 'https://github.com': "
         "No such device or address\n", [
             'git', 'ls-remote', u'https://github.com/eric/project0',
             u'refs/heads/master'
         ], 128,
         "fatal: could not read Username for 'https://github.com': No such device or address\n"
     )
     ps = PackageSource.objects.get(id=1)
     self.assertFalse(ps.poll())
     run_cmd.assert_called_with([
         'git', 'ls-remote', 'https://github.com/eric/project0',
         'refs/heads/master'
     ])
     self.assertTrue(ps.disabled)
     self.assertTrue(ps.last_failure_time)
     self.assertEquals(
         ps.last_failure,
         "fatal: could not read Username for 'https://github.com': No such device or address\n"
     )
Esempio n. 7
0
 def test_poll_changes(self, run_cmd):
     run_cmd.return_value = b'cdf46dc0-a49c-11e5-b00a-c712eaff3d7c	refs/heads/master\n'
     ps = PackageSource.objects.get(id=1)
     self.assertTrue(ps.poll())
     run_cmd.assert_called_with(['git', 'ls-remote', 'https://github.com/eric/project0', 'refs/heads/master'])