def test0504_push_exception(self): with self.assertRaises(gitcmd.NotInRepositoryError): gitcmd.push('/tmp', 'url') local = os.path.join(LOCAL_DIRS, 'local') with self.assertRaises(ValueError): gitcmd.push(os.path.join(local, 'test'), 'url', "username")
def test0600_branch(self): local = os.path.join(LOCAL_DIRS, 'local') test_file = os.path.join(local, 'test') gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local') open(test_file, 'w+').close() gitcmd.add(test_file) gitcmd.commit(test_file, 'test') gitcmd.push(local, HOST_DIR) ret, out, err = gitcmd.branch(local) self.assertEqual(ret, 0) self.assertEqual(out, "* master\n")
def test1005_pull_exception(self): with self.assertRaises(gitcmd.NotInRepositoryError): gitcmd.pull('/tmp', 'url') local = os.path.join(LOCAL_DIRS, 'local') test_file = os.path.join(local, 'testfile') test_file2 = os.path.join(local, 'testfile') gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local') gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local2') open(test_file, 'w+').close() gitcmd.add(test_file) gitcmd.commit(test_file, 'test') gitcmd.push(local, HOST_DIR) with self.assertRaises(ValueError): gitcmd.pull(test_file2, HOST_DIR, "username")
def test1001_pull_no_url(self): local = os.path.join(LOCAL_DIRS, 'local') local2 = os.path.join(LOCAL_DIRS, 'local2') test_file = os.path.join(local, 'testfile') test_file2 = os.path.join(local, 'testfile') gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local') gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local2') open(test_file, 'w+').close() gitcmd.add(test_file) gitcmd.commit(test_file, 'test') gitcmd.push(local, HOST_DIR) ret, out, err = gitcmd.pull(local2) self.assertEqual(ret, 0) self.assertIn("Fast-forward\n testfile", out) self.assertTrue(os.path.isfile(test_file2))
def test0501_push_no_url(self): local = os.path.join(LOCAL_DIRS, 'local') test_file = os.path.join(local, 'test') gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local') open(test_file, 'w+').close() gitcmd.add(test_file) gitcmd.commit(test_file, 'test') ret, out, err = gitcmd.push(local) self.assertEqual(ret, 0) self.assertIn("master -> master", err)
def test0503_push_exception(self): with self.assertRaises(gitcmd.NotInRepositoryError): gitcmd.push('/tmp', 'url')