changeset 6471:8b4c09e740a7

tests: add commit_change() author to specify author name explicitly This allows creation of revisions with arbitrary "author" information.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 23 Jan 2017 02:17:38 +0900
parents 8377f2bfb88f
children e6224a7c3d4e
files kallithea/tests/fixture.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/fixture.py	Mon Jan 23 01:56:39 2017 +0100
+++ b/kallithea/tests/fixture.py	Mon Jan 23 02:17:38 2017 +0900
@@ -274,11 +274,14 @@
 
         return source
 
-    def commit_change(self, repo, filename, content, message, vcs_type, parent=None, newfile=False):
+    def commit_change(self, repo, filename, content, message, vcs_type,
+                      parent=None, newfile=False, author=None):
         repo = Repository.get_by_repo_name(repo)
         _cs = parent
-        if not parent:
+        if parent is None:
             _cs = EmptyChangeset(alias=vcs_type)
+        if author is None:
+            author = TEST_USER_ADMIN_LOGIN
 
         if newfile:
             nodes = {
@@ -291,13 +294,13 @@
                 message=message,
                 nodes=nodes,
                 parent_cs=_cs,
-                author=TEST_USER_ADMIN_LOGIN,
+                author=author,
             )
         else:
             cs = ScmModel().commit_change(
                 repo=repo.scm_instance, repo_name=repo.repo_name,
                 cs=parent, user=TEST_USER_ADMIN_LOGIN,
-                author=TEST_USER_ADMIN_LOGIN,
+                author=author,
                 message=message,
                 content=content,
                 f_path=filename