# HG changeset patch # User Marcin Kuzminski # Date 2019-07-11 18:22:45 # Node ID eb39c224744038f3dbe7204881b34bca1504cc18 # Parent 3efd68451b8102968cbe71db0b1a0492692ff24e tests: fixed author for commit messages to be in a proper format. diff --git a/rhodecode/apps/repository/tests/test_repo_pullrequests.py b/rhodecode/apps/repository/tests/test_repo_pullrequests.py --- a/rhodecode/apps/repository/tests/test_repo_pullrequests.py +++ b/rhodecode/apps/repository/tests/test_repo_pullrequests.py @@ -871,6 +871,7 @@ class TestPullrequestsView(object): {'message': 'new-feature', 'branch': branch_name}, ] repo = backend_git.create_repo(commits) + repo_name = repo.repo_name commit_ids = backend_git.commit_ids pull_request = PullRequest() @@ -888,13 +889,15 @@ class TestPullrequestsView(object): Session().add(pull_request) Session().commit() + pull_request_id = pull_request.pull_request_id + vcs = repo.scm_instance() vcs.remove_ref('refs/heads/{}'.format(branch_name)) response = self.app.get(route_path( 'pullrequest_show', - repo_name=repo.repo_name, - pull_request_id=pull_request.pull_request_id)) + repo_name=repo_name, + pull_request_id=pull_request_id)) assert response.status_int == 200 diff --git a/rhodecode/tests/plugin.py b/rhodecode/tests/plugin.py --- a/rhodecode/tests/plugin.py +++ b/rhodecode/tests/plugin.py @@ -834,7 +834,7 @@ class VcsBackend(object): imc.add(FileNode(filename, content=content)) imc.commit( message=u'Automatic commit from vcsbackend fixture', - author=u'Automatic') + author=u'Automatic ') def ensure_file(self, filename, content='Test content\n'): assert self._cleanup_repos, "Avoid writing into vcs_test repos" @@ -869,7 +869,7 @@ def _add_commits_to_repo(vcs_repo, commi commit = imc.commit( message=message, - author=unicode(commit.get('author', 'Automatic')), + author=unicode(commit.get('author', 'Automatic ')), date=commit.get('date'), branch=commit.get('branch'), parents=parents) diff --git a/rhodecode/tests/utils.py b/rhodecode/tests/utils.py --- a/rhodecode/tests/utils.py +++ b/rhodecode/tests/utils.py @@ -425,13 +425,13 @@ def commit_change( message=message, nodes=nodes, parent_commit=_commit, - author=TEST_USER_ADMIN_LOGIN, + author='{} '.format(TEST_USER_ADMIN_LOGIN), ) else: commit = ScmModel().commit_change( repo=repo.scm_instance(), repo_name=repo.repo_name, commit=parent, user=TEST_USER_ADMIN_LOGIN, - author=TEST_USER_ADMIN_LOGIN, + author='{} '.format(TEST_USER_ADMIN_LOGIN), message=message, content=content, f_path=filename diff --git a/rhodecode/tests/vcs/test_branches.py b/rhodecode/tests/vcs/test_branches.py --- a/rhodecode/tests/vcs/test_branches.py +++ b/rhodecode/tests/vcs/test_branches.py @@ -59,7 +59,7 @@ class TestBranches(BackendTestMixin): content='Documentation\n')) foobar_tip = self.imc.commit( message=u'New branch: foobar', - author=u'joe', + author=u'joe ', branch='foobar', ) assert 'foobar' in self.repo.branches @@ -73,7 +73,7 @@ class TestBranches(BackendTestMixin): content='Documentation\n')) foobar_tip = self.imc.commit( message=u'New branch: foobar', - author=u'joe', + author=u'joe ', branch='foobar', parents=[tip], ) @@ -82,14 +82,14 @@ class TestBranches(BackendTestMixin): content='Documentation\nand more...\n')) newtip = self.imc.commit( message=u'At default branch', - author=u'joe', + author=u'joe ', branch=foobar_tip.branch, parents=[foobar_tip], ) newest_tip = self.imc.commit( message=u'Merged with %s' % foobar_tip.raw_id, - author=u'joe', + author=u'joe ', branch=self.backend_class.DEFAULT_BRANCH_NAME, parents=[newtip, foobar_tip], ) @@ -101,7 +101,7 @@ class TestBranches(BackendTestMixin): def test_branch_with_slash_in_name(self): self.imc.add(FileNode('extrafile', content='Some data\n')) self.imc.commit( - u'Branch with a slash!', author=u'joe', + u'Branch with a slash!', author=u'joe ', branch='issue/123') assert 'issue/123' in self.repo.branches @@ -109,11 +109,11 @@ class TestBranches(BackendTestMixin): def test_branch_with_slash_in_name_and_similar_without(self): self.imc.add(FileNode('extrafile', content='Some data\n')) self.imc.commit( - u'Branch with a slash!', author=u'joe', + u'Branch with a slash!', author=u'joe ', branch='issue/123') self.imc.add(FileNode('extrafile II', content='Some data\n')) self.imc.commit( - u'Branch without a slash...', author=u'joe', + u'Branch without a slash...', author=u'joe ', branch='123') assert 'issue/123' in self.repo.branches assert '123' in self.repo.branches diff --git a/rhodecode/tests/vcs/test_commits.py b/rhodecode/tests/vcs/test_commits.py --- a/rhodecode/tests/vcs/test_commits.py +++ b/rhodecode/tests/vcs/test_commits.py @@ -76,7 +76,7 @@ class TestCommitsInNonEmptyRepo(BackendT content='Documentation\n')) foobar_tip = self.imc.commit( message=u'New branch: foobar', - author=u'joe', + author=u'joe ', branch='foobar', ) assert 'foobar' in self.repo.branches @@ -92,7 +92,7 @@ class TestCommitsInNonEmptyRepo(BackendT content='Documentation\n')) foobar_tip = self.imc.commit( message=u'New branch: foobar', - author=u'joe', + author=u'joe ', branch='foobar', parents=[tip], ) @@ -100,14 +100,14 @@ class TestCommitsInNonEmptyRepo(BackendT content='Documentation\nand more...\n')) newtip = self.imc.commit( message=u'At default branch', - author=u'joe', + author=u'joe ', branch=foobar_tip.branch, parents=[foobar_tip], ) newest_tip = self.imc.commit( message=u'Merged with %s' % foobar_tip.raw_id, - author=u'joe', + author=u'joe ', branch=self.backend_class.DEFAULT_BRANCH_NAME, parents=[newtip, foobar_tip], ) @@ -134,28 +134,28 @@ class TestCommitsInNonEmptyRepo(BackendT self.imc.add(FileNode('readme.txt', content='Document\n')) initial = self.imc.commit( message=u'Initial commit', - author=u'joe', + author=u'joe ', parents=[org_tip], branch=DEFAULT_BRANCH,) self.imc.add(FileNode('newdoc.txt', content='foobar\n')) docs_branch_commit1 = self.imc.commit( message=u'New branch: docs', - author=u'joe', + author=u'joe ', parents=[initial], branch=TEST_BRANCH,) self.imc.add(FileNode('newdoc2.txt', content='foobar2\n')) docs_branch_commit2 = self.imc.commit( message=u'New branch: docs2', - author=u'joe', + author=u'joe ', parents=[docs_branch_commit1], branch=TEST_BRANCH,) self.imc.add(FileNode('newfile', content='hello world\n')) self.imc.commit( message=u'Back in default branch', - author=u'joe', + author=u'joe ', parents=[initial], branch=DEFAULT_BRANCH,) diff --git a/rhodecode/tests/vcs/test_hg.py b/rhodecode/tests/vcs/test_hg.py --- a/rhodecode/tests/vcs/test_hg.py +++ b/rhodecode/tests/vcs/test_hg.py @@ -586,7 +586,7 @@ TODO: To be written... imc.add(FileNode('file_x', content=source_repo.name)) imc.commit( message=u'Automatic commit from repo merge test', - author=u'Automatic') + author=u'Automatic ') target_commit = target_repo.get_commit() source_commit = source_repo.get_commit() default_branch = target_repo.DEFAULT_BRANCH_NAME @@ -630,7 +630,7 @@ TODO: To be written... imc.add(FileNode('file_x', content=source_repo.name)) imc.commit( message=u'Automatic commit from repo merge test', - author=u'Automatic') + author=u'Automatic ') target_commit = target_repo.get_commit() source_commit = source_repo.get_commit() default_branch = target_repo.DEFAULT_BRANCH_NAME @@ -669,7 +669,7 @@ TODO: To be written... commits = list(target_repo.get_commits()) imc.commit( message=u'Automatic commit from repo merge test', - author=u'Automatic', parents=commits[0:1]) + author=u'Automatic ', parents=commits[0:1]) target_commit = target_repo.get_commit() source_commit = source_repo.get_commit() @@ -702,7 +702,7 @@ TODO: To be written... imc.add(FileNode('file_x', content=source_repo.name)) imc.commit( message=u'Automatic commit from repo merge test', - author=u'Automatic') + author=u'Automatic ') target_commit = target_repo.get_commit() source_commit = source_repo.get_commit() diff --git a/rhodecode/tests/vcs/test_inmemory.py b/rhodecode/tests/vcs/test_inmemory.py --- a/rhodecode/tests/vcs/test_inmemory.py +++ b/rhodecode/tests/vcs/test_inmemory.py @@ -116,7 +116,7 @@ class TestInMemoryCommit(BackendTestMixi def commit(self, branch=None): self.old_commit_count = len(self.repo.commit_ids) self.commit_message = u'Test commit with unicode: żółwik' - self.commit_author = unicode(self.__class__) + self.commit_author = u'{} '.format(self.__class__.__name__) self.commit = self.imc.commit( message=self.commit_message, author=self.commit_author, branch=branch) @@ -127,7 +127,7 @@ class TestInMemoryCommit(BackendTestMixi FileNode('foo/README.txt', content='readme!'), ] self.imc.add(*to_add) - commit = self.imc.commit(u'Initial', u'joe.doe@example.com') + commit = self.imc.commit(u'Initial', u'joe doe ') assert isinstance(commit.get_node('foo'), DirNode) assert isinstance(commit.get_node('foo/bar'), DirNode) self.assert_nodes_in_commit(commit, to_add) @@ -141,7 +141,7 @@ class TestInMemoryCommit(BackendTestMixi FileNode('foobar/barbaz', content='foo'), ] self.imc.add(*to_add) - commit = self.imc.commit(u'Another', u'joe.doe@example.com') + commit = self.imc.commit(u'Another', u'joe doe ') self.assert_nodes_in_commit(commit, to_add) def test_add_raise_already_added(self): @@ -153,20 +153,20 @@ class TestInMemoryCommit(BackendTestMixi def test_check_integrity_raise_already_exist(self): node = FileNode('foobar', content='baz') self.imc.add(node) - self.imc.commit(message=u'Added foobar', author=unicode(self)) + self.imc.commit(message=u'Added foobar', author=u'{} '.format(self)) self.imc.add(node) with pytest.raises(NodeAlreadyExistsError): - self.imc.commit(message='new message', author=str(self)) + self.imc.commit(message='new message', author=u'{} '.format(self)) def test_change(self): self.imc.add(FileNode('foo/bar/baz', content='foo')) self.imc.add(FileNode('foo/fbar', content='foobar')) - tip = self.imc.commit(u'Initial', u'joe.doe@example.com') + tip = self.imc.commit(u'Initial', u'joe doe ') # Change node's content node = FileNode('foo/bar/baz', content='My **changed** content') self.imc.change(node) - self.imc.commit(u'Changed %s' % node.path, u'joe.doe@example.com') + self.imc.commit(u'Changed %s' % node.path, u'joe doe ') newtip = self.repo.get_commit() assert tip != newtip @@ -181,19 +181,19 @@ class TestInMemoryCommit(BackendTestMixi for node in to_add: self.imc.add(node) - tip = self.imc.commit(u'Initial', u'joe.doe@example.com') + tip = self.imc.commit(u'Initial', u'joe doe ') # Change node's content node = FileNode('żółwik/zwierzątko', content='My **changed** content') self.imc.change(node) self.imc.commit(u'Changed %s' % safe_unicode(node.path), - u'joe.doe@example.com') + author=u'joe doe ') node_uni = FileNode( u'żółwik/zwierzątko_uni', content=u'My **changed** content') self.imc.change(node_uni) self.imc.commit(u'Changed %s' % safe_unicode(node_uni.path), - u'joe.doe@example.com') + author=u'joe doe ') newtip = self.repo.get_commit() assert tip != newtip @@ -209,18 +209,16 @@ class TestInMemoryCommit(BackendTestMixi def test_check_integrity_change_raise_node_does_not_exist(self): node = FileNode('foobar', content='baz') self.imc.add(node) - self.imc.commit(message=u'Added foobar', author=unicode(self)) + self.imc.commit(message=u'Added foobar', author=u'{} '.format(self)) node = FileNode('not-foobar', content='') self.imc.change(node) with pytest.raises(NodeDoesNotExistError): - self.imc.commit( - message='Changed not existing node', - author=str(self)) + self.imc.commit(message='Changed not existing node', author=u'{} '.format(self)) def test_change_raise_node_already_changed(self): node = FileNode('foobar', content='baz') self.imc.add(node) - self.imc.commit(message=u'Added foobar', author=unicode(self)) + self.imc.commit(message=u'Added foobar', author=u'{} '.format(self)) node = FileNode('foobar', content='more baz') self.imc.change(node) with pytest.raises(NodeAlreadyChangedError): @@ -234,12 +232,12 @@ class TestInMemoryCommit(BackendTestMixi with pytest.raises(NodeNotChangedError): self.imc.commit( message=u'Trying to mark node as changed without touching it', - author=unicode(self)) + author=u'{} '.format(self)) def test_change_raise_node_already_removed(self): node = FileNode('foobar', content='baz') self.imc.add(node) - self.imc.commit(message=u'Added foobar', author=unicode(self)) + self.imc.commit(message=u'Added foobar', author=u'{} '.format(self)) self.imc.remove(FileNode('foobar')) with pytest.raises(NodeAlreadyRemovedError): self.imc.change(node) @@ -252,7 +250,7 @@ class TestInMemoryCommit(BackendTestMixi assert node.content == tip.get_node(node.path).content self.imc.remove(node) self.imc.commit( - message=u'Removed %s' % node.path, author=unicode(self)) + message=u'Removed %s' % node.path, author=u'{} '.format(self)) newtip = self.repo.get_commit() assert tip != newtip @@ -263,10 +261,10 @@ class TestInMemoryCommit(BackendTestMixi def test_remove_last_file_from_directory(self): node = FileNode('omg/qwe/foo/bar', content='foobar') self.imc.add(node) - self.imc.commit(u'added', u'joe doe') + self.imc.commit(u'added', author=u'joe doe ') self.imc.remove(node) - tip = self.imc.commit(u'removed', u'joe doe') + tip = self.imc.commit(u'removed', u'joe doe ') with pytest.raises(NodeDoesNotExistError): tip.get_node('omg/qwe/foo/bar') @@ -275,7 +273,7 @@ class TestInMemoryCommit(BackendTestMixi with pytest.raises(NodeDoesNotExistError): self.imc.commit( message='Trying to remove node at empty repository', - author=str(self)) + author=u'{} '.format(self)) def test_check_integrity_remove_raise_node_does_not_exist(self, nodes): self.test_add(nodes) # Performs first commit @@ -285,7 +283,7 @@ class TestInMemoryCommit(BackendTestMixi with pytest.raises(NodeDoesNotExistError): self.imc.commit( message=u'Trying to remove not existing node', - author=unicode(self)) + author=u'{} '.format(self)) def test_remove_raise_node_already_removed(self, nodes): self.test_add(nodes) # Performs first commit @@ -318,7 +316,7 @@ class TestInMemoryCommit(BackendTestMixi content = 'foobar\n' * x node = FileNode(fname, content=content) self.imc.add(node) - commit = self.imc.commit(u"Commit no. %s" % (x + 1), author=u'vcs') + commit = self.imc.commit(u"Commit no. %s" % (x + 1), author=u'vcs ') assert last != commit last = commit @@ -335,7 +333,7 @@ class TestInMemoryCommit(BackendTestMixi date = datetime.datetime(1985, 1, 30, 1, 45) commit = self.imc.commit( u"Committed at time when I was born ;-)", - author=u'lb', date=date) + author=u'{} '.format(self), date=date) assert commit.date == local_dt_to_utc(date) diff --git a/rhodecode/tests/vcs/test_repository.py b/rhodecode/tests/vcs/test_repository.py --- a/rhodecode/tests/vcs/test_repository.py +++ b/rhodecode/tests/vcs/test_repository.py @@ -279,7 +279,7 @@ class TestRepositoryMerge(object): imc.add(FileNode('file_x', content=self.source_repo.name)) imc.commit( message=u'Automatic commit from repo merge test', - author=u'Automatic') + author=u'Automatic ') self.target_commit = self.target_repo.get_commit() self.source_commit = self.source_repo.get_commit() # This only works for Git and Mercurial diff --git a/rhodecode/tests/vcs_operations/test_vcs_calls_small_post_buffer.py b/rhodecode/tests/vcs_operations/test_vcs_calls_small_post_buffer.py --- a/rhodecode/tests/vcs_operations/test_vcs_calls_small_post_buffer.py +++ b/rhodecode/tests/vcs_operations/test_vcs_calls_small_post_buffer.py @@ -58,7 +58,7 @@ def test_git_push_with_small_push_buffer repo.in_memory_commit.add(FileNode('readme.md', content='## Hello')) repo.in_memory_commit.commit( message='Commit on branch Master', - author='Automatic test', + author='Automatic test ', branch='master') repo_cmd = Command(repo.path) diff --git a/rhodecode/tests/vcs_operations/test_vcs_operations_special.py b/rhodecode/tests/vcs_operations/test_vcs_operations_special.py --- a/rhodecode/tests/vcs_operations/test_vcs_operations_special.py +++ b/rhodecode/tests/vcs_operations/test_vcs_operations_special.py @@ -50,7 +50,7 @@ class TestVCSOperationsSpecial(object): repo.in_memory_commit.add(FileNode('file', content='')) repo.in_memory_commit.commit( message='Commit on branch test', - author='Automatic test', + author='Automatic test ', branch='test') repo_cmd = Command(repo.path) @@ -92,7 +92,7 @@ class TestVCSOperationsSpecial(object): repo.in_memory_commit.add(FileNode('readme.md', content='## Hello')) repo.in_memory_commit.commit( message='Commit on branch Master', - author='Automatic test', + author='Automatic test ', branch='master') repo_cmd = Command(repo.path) @@ -109,7 +109,7 @@ class TestVCSOperationsSpecial(object): repo.in_memory_commit.add(FileNode('setup.py', content='print\n')) repo.in_memory_commit.commit( message='Commit2 on branch Master', - author='Automatic test2', + author='Automatic test2 ', branch='master') repo_cmd = Command(repo.path) @@ -124,7 +124,7 @@ class TestVCSOperationsSpecial(object): repo.in_memory_commit.add(FileNode('feature1.py', content='## Hello world')) repo.in_memory_commit.commit( message='Commit on branch feature', - author='Automatic test', + author='Automatic test ', branch='feature') repo_cmd = Command(repo.path)