|
|
@ -1,5 +1,6 @@
|
|
|
|
import unittest
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
|
|
import sand_env
|
|
|
|
import sand_env
|
|
|
|
|
|
|
|
|
|
|
@ -16,12 +17,22 @@ class TestGitPlugin(sand_env.SandboxedCommandTestCase):
|
|
|
|
|
|
|
|
|
|
|
|
def setUp(self, nsec_stat=True):
|
|
|
|
def setUp(self, nsec_stat=True):
|
|
|
|
super(TestGitPlugin, self).setUp()
|
|
|
|
super(TestGitPlugin, self).setUp()
|
|
|
|
|
|
|
|
# Backup environment variables and set git author
|
|
|
|
|
|
|
|
self.env_backup = os.environ.copy()
|
|
|
|
|
|
|
|
os.environ['GIT_AUTHOR_NAME'] = "Pubs test"
|
|
|
|
|
|
|
|
os.environ['GIT_AUTHOR_EMAIL'] = "unittest@pubs.org"
|
|
|
|
|
|
|
|
# Setup pubs repository
|
|
|
|
self.execute_cmds([('pubs init',)])
|
|
|
|
self.execute_cmds([('pubs init',)])
|
|
|
|
conf = config.load_conf(path=self.default_conf_path)
|
|
|
|
conf = config.load_conf(path=self.default_conf_path)
|
|
|
|
conf['plugins']['active'] = ['git']
|
|
|
|
conf['plugins']['active'] = ['git']
|
|
|
|
config.save_conf(conf, path=self.default_conf_path)
|
|
|
|
config.save_conf(conf, path=self.default_conf_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def tearDown(self):
|
|
|
|
|
|
|
|
super().tearDown()
|
|
|
|
|
|
|
|
os.environ = self.env_backup
|
|
|
|
|
|
|
|
|
|
|
|
def test_git(self):
|
|
|
|
def test_git(self):
|
|
|
|
|
|
|
|
print(self.default_pubs_dir)
|
|
|
|
self.execute_cmds([('pubs add data/pagerank.bib',)])
|
|
|
|
self.execute_cmds([('pubs add data/pagerank.bib',)])
|
|
|
|
hash_a = git_hash(self.default_pubs_dir)
|
|
|
|
hash_a = git_hash(self.default_pubs_dir)
|
|
|
|
|
|
|
|
|
|
|
@ -72,6 +83,7 @@ class TestGitPlugin(sand_env.SandboxedCommandTestCase):
|
|
|
|
# self.assertEqual(hash_i, hash_j)
|
|
|
|
# self.assertEqual(hash_i, hash_j)
|
|
|
|
|
|
|
|
|
|
|
|
def test_manual(self):
|
|
|
|
def test_manual(self):
|
|
|
|
|
|
|
|
print(self.default_pubs_dir)
|
|
|
|
conf = config.load_conf(path=self.default_conf_path)
|
|
|
|
conf = config.load_conf(path=self.default_conf_path)
|
|
|
|
conf['plugins']['active'] = ['git']
|
|
|
|
conf['plugins']['active'] = ['git']
|
|
|
|
conf['plugins']['git']['manual'] = True
|
|
|
|
conf['plugins']['git']['manual'] = True
|
|
|
|