diff options
-rwxr-xr-x | debian/rules | 2 | ||||
-rw-r--r-- | gbp/git.py | 4 | ||||
-rw-r--r-- | tests/test_GitModifier.py | 23 |
3 files changed, 27 insertions, 2 deletions
diff --git a/debian/rules b/debian/rules index a2bc9215..d70542fd 100755 --- a/debian/rules +++ b/debian/rules @@ -54,7 +54,7 @@ links_stamp: apidocs: links_stamp epydoc -v -n git-buildpackage --no-sourcecode -o docs/apidocs/ \ - gbp*.py git*.py gbp/ tests/test_GitRepository.py + gbp*.py git*.py gbp/ tests/test_Git*.py ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) pychecker: @@ -33,7 +33,9 @@ class GitRepositoryError(Exception): class GitModifier(object): """Stores authorship/comitter information""" def __init__(self, name=None, email=None, date=None): - self.__dict__.update(locals()) + self.name = name + self.email = email + self.date = date def _get_env(self, who): """Get author or comitter information as env var dictionary""" diff --git a/tests/test_GitModifier.py b/tests/test_GitModifier.py new file mode 100644 index 00000000..10188a0e --- /dev/null +++ b/tests/test_GitModifier.py @@ -0,0 +1,23 @@ +# vim: set fileencoding=utf-8 : + +""" +Test L{gbp.git.GitModifier} +""" + +def test_author(): + """ + Methods tested: + - L{gbp.git.GitModifer.get_author_env} + - L{gbp.git.GitModifer.get_comitter_env} + + >>> import gbp.git + >>> modifier = gbp.git.GitModifier("foo", "bar") + >>> modifier.name + 'foo' + >>> modifier.email + 'bar' + >>> modifier.get_author_env() + {'GIT_AUTHOR_EMAIL': 'bar', 'GIT_AUTHOR_NAME': 'foo'} + >>> modifier.get_committer_env() + {'GIT_COMMITTER_NAME': 'foo', 'GIT_COMMITTER_EMAIL': 'bar'} + """ |