changeset 3009:f0e19116f154 beta

fixed file history tests
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 16 Nov 2012 21:09:50 +0100
parents 6e76b4892d72
children bf96fd1920c1
files rhodecode/controllers/files.py rhodecode/tests/functional/test_files.py
diffstat 2 files changed, 28 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/files.py	Thu Nov 15 00:57:52 2012 +0100
+++ b/rhodecode/controllers/files.py	Fri Nov 16 21:09:50 2012 +0100
@@ -551,8 +551,6 @@
         :param changesets: if passed don't calculate history and take
             changesets defined in this list
         """
-        import time
-        s = time.time()
         # calculate history based on tip
         tip_cs = c.rhodecode_repo.get_changeset()
         if changesets is None:
@@ -561,7 +559,6 @@
             except (NodeDoesNotExistError, ChangesetError):
                 #this node is not present at tip !
                 changesets = cs.get_file_history(f_path)
-        print time.time()-s
         hist_l = []
 
         changesets_group = ([], _("Changesets"))
@@ -571,9 +568,8 @@
         for chs in changesets:
             #_branch = '(%s)' % chs.branch if _hg else ''
             _branch = chs.branch
-            n_desc = 'r%s:%s %s' % (chs.revision, chs.short_id, _branch)
+            n_desc = 'r%s:%s (%s)' % (chs.revision, chs.short_id, _branch)
             changesets_group[0].append((chs.raw_id, n_desc,))
-        print time.time()-s
         hist_l.append(changesets_group)
 
         for name, chs in c.rhodecode_repo.branches.items():
@@ -583,7 +579,7 @@
         for name, chs in c.rhodecode_repo.tags.items():
             tags_group[0].append((chs, name),)
         hist_l.append(tags_group)
-        print time.time()-s
+
         return hist_l, changesets
 
     @LoginRequired()
--- a/rhodecode/tests/functional/test_files.py	Thu Nov 15 00:57:52 2012 +0100
+++ b/rhodecode/tests/functional/test_files.py	Fri Nov 16 21:09:50 2012 +0100
@@ -73,6 +73,22 @@
                                     revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
                                     f_path='vcs/nodes.py'))
 
+        response.mustcontain("""<div class="commit">Partially implemented <a class="issue-tracker-link" href="https://myissueserver.com/vcs_test_hg/issue/16">#16</a>. filecontent/commit message/author/node name are safe_unicode now.
+In addition some other __str__ are unicode as well
+Added test for unicode
+Improved test to clone into uniq repository.
+removed extra unicode conversion in diff.</div>
+""")
+
+        response.mustcontain("""<span style="text-transform: uppercase;"><a href="#">branch: default</a></span>""")
+
+    def test_file_source_history(self):
+        self.log_user()
+        response = self.app.get(url(controller='files', action='history',
+                                    repo_name=HG_REPO,
+                                    revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
+                                    f_path='vcs/nodes.py'),
+                                extra_environ={'HTTP_X_PARTIAL_XHR': '1'},)
         #test or history
         response.mustcontain("""<optgroup label="Changesets">
 <option selected="selected" value="8911406ad776fdd3d0b9932a2e89677e57405a48">r167:8911406ad776 (default)</option>
@@ -123,15 +139,6 @@
 </optgroup>
 """)
 
-        response.mustcontain("""<div class="commit">Partially implemented <a class="issue-tracker-link" href="https://myissueserver.com/vcs_test_hg/issue/16">#16</a>. filecontent/commit message/author/node name are safe_unicode now.
-In addition some other __str__ are unicode as well
-Added test for unicode
-Improved test to clone into uniq repository.
-removed extra unicode conversion in diff.</div>
-""")
-
-        response.mustcontain("""<span style="text-transform: uppercase;"><a href="#">branch: default</a></span>""")
-
     def test_file_annotation(self):
         self.log_user()
         response = self.app.get(url(controller='files', action='index',
@@ -140,6 +147,16 @@
                                     f_path='vcs/nodes.py',
                                     annotate=True))
 
+        response.mustcontain("""<span style="text-transform: uppercase;"><a href="#">branch: default</a></span>""")
+
+    def test_file_annotation_history(self):
+        self.log_user()
+        response = self.app.get(url(controller='files', action='history',
+                                    repo_name=HG_REPO,
+                                    revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
+                                    f_path='vcs/nodes.py',
+                                    annotate=True),
+                                extra_environ={'HTTP_X_PARTIAL_XHR': '1'})
 
         response.mustcontain("""<optgroup label="Changesets">
 <option selected="selected" value="8911406ad776fdd3d0b9932a2e89677e57405a48">r167:8911406ad776 (default)</option>
@@ -189,8 +206,6 @@
 <option value="eb3a60fc964309c1a318b8dfe26aa2d1586c85ae">0.1.1</option>
 </optgroup>""")
 
-        response.mustcontain("""<span style="text-transform: uppercase;"><a href="#">branch: default</a></span>""")
-
     def test_file_annotation_git(self):
         self.log_user()
         response = self.app.get(url(controller='files', action='index',