Changeset - ff9e0cbfcd7f
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2012-11-24 02:12:48
marcin@python-works.com
fixed tests for databases that have FKs. Thank you sqlite...
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/tests/functional/test_compare.py
Show inline comments
 
@@ -90,50 +90,51 @@ class TestCompareController(TestControll
 
        rev2 = 'default'
 
        response = self.app.get(url(controller='compare', action='index',
 
                                    repo_name=repo2.repo_name,
 
                                    org_ref_type="branch",
 
                                    org_ref=rev1,
 
                                    other_ref_type="branch",
 
                                    other_ref=rev2,
 
                                    repo=repo1.repo_name
 
                                    ))
 

	
 
        try:
 
            response.mustcontain('%s@%s -> %s@%s' % (repo2.repo_name, rev1, repo1.repo_name, rev2))
 
            response.mustcontain("""Showing 2 commits""")
 
            response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
 

	
 
            response.mustcontain("""<div class="message tooltip" title="commit2" style="white-space:normal">commit2</div>""")
 
            response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""")
 

	
 
            response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
 
            response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
 
            ## files
 
            response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2))
 

	
 
        finally:
 
            RepoModel().delete(r2_id)
 
            RepoModel().delete(r1_id)
 
            RepoModel().delete(r2_id)
 
            
 

	
 
    def test_compare_forks_on_branch_extra_commits_origin_has_incomming_hg(self):
 
        self.log_user()
 

	
 
        repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
 
                                        description='diff-test',
 
                                        owner=TEST_USER_ADMIN_LOGIN)
 
        r1_id = repo1.repo_id
 
        Session().commit()
 
        #commit something !
 
        cs0 = _commit_change(repo1.repo_name, filename='file1', content='line1\n',
 
                             message='commit1', vcs_type='hg', parent=None, newfile=True)
 

	
 
        #fork this repo
 
        repo2 = _fork_repo('one-fork', 'hg', parent='one')
 
        Session().commit()
 

	
 
        #now commit something to origin repo
 
        cs1_prim = _commit_change(repo1.repo_name, filename='file2', content='line1file2\n',
 
                                  message='commit2', vcs_type='hg', parent=cs0, newfile=True)
 

	
 
        r2_id = repo2.repo_id
 

	
 
        #add two extra commit into fork
 
@@ -147,50 +148,50 @@ class TestCompareController(TestControll
 
        rev2 = 'default'
 
        response = self.app.get(url(controller='compare', action='index',
 
                                    repo_name=repo2.repo_name,
 
                                    org_ref_type="branch",
 
                                    org_ref=rev1,
 
                                    other_ref_type="branch",
 
                                    other_ref=rev2,
 
                                    repo=repo1.repo_name
 
                                    ))
 

	
 
        try:
 
            response.mustcontain('%s@%s -> %s@%s' % (repo2.repo_name, rev1, repo1.repo_name, rev2))
 
            response.mustcontain("""Showing 2 commits""")
 
            response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
 

	
 
            response.mustcontain("""<div class="message tooltip" title="commit2" style="white-space:normal">commit2</div>""")
 
            response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""")
 

	
 
            response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
 
            response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
 
            ## files
 
            response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2))
 

	
 
        finally:
 
            RepoModel().delete(r2_id)
 
            RepoModel().delete(r1_id)
 
            RepoModel().delete(r2_id)
 

	
 

	
 
#    def test_compare_remote_repos_remote_flag_off(self):
 
#        self.log_user()
 
#        _fork_repo(HG_FORK, 'hg')
 
#
 
#        rev1 = '56349e29c2af'
 
#        rev2 = '7d4bc8ec6be5'
 
#
 
#        response = self.app.get(url(controller='compare', action='index',
 
#                                    repo_name=HG_REPO,
 
#                                    org_ref_type="rev",
 
#                                    org_ref=rev1,
 
#                                    other_ref_type="rev",
 
#                                    other_ref=rev2,
 
#                                    repo=HG_FORK,
 
#                                    bundle=False,
 
#                                    ))
 
#
 
#        try:
 
#            response.mustcontain('%s@%s -> %s@%s' % (HG_REPO, rev1, HG_FORK, rev2))
 
#            ## outgoing changesets between those revisions
 
#
 
#            response.mustcontain("""<a href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_REPO))
0 comments (0 inline, 0 general)