You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/06/15 14:28:03 UTC

[44/46] allura git commit: [#7873] Add tests for git branch/tag cache system

[#7873] Add tests for git branch/tag cache system


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/f24debe7
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/f24debe7
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/f24debe7

Branch: refs/heads/hs/7873
Commit: f24debe77605f328768c0c30ae76664cfcd6307d
Parents: 0bdceea
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 08:25:17 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Mon Jun 15 08:26:32 2015 -0400

----------------------------------------------------------------------
 ForgeGit/forgegit/tests/functional/test_controllers.py |  5 ++++-
 ForgeGit/forgegit/tests/model/test_repository.py       | 11 +++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/f24debe7/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 917f765..29c6453 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -390,7 +390,10 @@ class TestRootController(_TestCase):
 
     def test_default_branch(self):
         assert_equal(c.app.default_branch_name, 'master')
-        c.app.repo.set_default_branch('zz')
+        vv = c.app.repo.set_default_branch('zz')
+        print('-' * 10)
+        print(vv)
+        print('-' * 10)
         assert_equal(c.app.default_branch_name, 'zz')
         c.app.repo.set_default_branch('master')
         assert_equal(c.app.default_branch_name, 'master')

http://git-wip-us.apache.org/repos/asf/allura/blob/f24debe7/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 349efe6..47dc34d 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -728,6 +728,17 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
             res_with_tmp = self.repo.merge_request_commits(mr)
         assert_equals(res_without_tmp, res_with_tmp)
 
+    def test_cached_branches(self):
+        with mock.patch.dict('allura.lib.app_globals.config', {'repo_refs_cache_threshold': '0'}):
+            rev = GM.Repository.query.get(_id=self.repo['_id'])
+            branches = rev._impl._get_refs('branches')
+            assert_equal(rev.cached_branches, branches)
+
+    def test_cached_tags(self):
+        with mock.patch.dict('allura.lib.app_globals.config', {'repo_refs_cache_threshold': '0'}):
+            rev = GM.Repository.query.get(_id=self.repo['_id'])
+            tags = rev._impl._get_refs('tags')
+            assert_equal(rev.cached_tags, tags)
 
 class TestGitImplementation(unittest.TestCase):