diff rhodecode/tests/functional/test_home.py @ 3647:8a86836fad64 beta

more usage of fixture tools in tests
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 01 Apr 2013 23:45:25 +0200
parents f4ce9416cbd5
children ec6354949623
line wrap: on
line diff
--- a/rhodecode/tests/functional/test_home.py	Sun Mar 31 21:44:27 2013 +0200
+++ b/rhodecode/tests/functional/test_home.py	Mon Apr 01 23:45:25 2013 +0200
@@ -1,13 +1,15 @@
 import time
 from rhodecode.tests import *
+from rhodecode.tests.fixture import Fixture
 from rhodecode.model.meta import Session
-from rhodecode.model.db import User, RhodeCodeSetting, Repository
-from rhodecode.lib.utils import set_rhodecode_config
-from rhodecode.tests.models.common import _make_repo, _make_group
+from rhodecode.model.db import User, Repository
 from rhodecode.model.repo import RepoModel
 from rhodecode.model.repos_group import ReposGroupModel
 
 
+fixture = Fixture()
+
+
 class TestHomeController(TestController):
 
     def test_index(self):
@@ -75,18 +77,19 @@
 
         try:
             response = self.app.get(url(controller='home', action='index'))
-            response.mustcontain("""var data = {"totalRecords": %s""" % len(Repository.getAll()))
+            response.mustcontain("""var data = {"totalRecords": %s"""
+                                 % len(Repository.getAll()))
         finally:
             self._set_l_dash(False)
 
     def test_index_page_on_groups(self):
         self.log_user()
-        _make_repo(name='gr1/repo_in_group', repos_group=_make_group('gr1'))
-        Session().commit()
+        gr = fixture.create_group('gr1')
+        fixture.create_repo(name='gr1/repo_in_group', repos_group=gr)
         response = self.app.get(url('repos_group_home', group_name='gr1'))
 
         try:
-            response.mustcontain("""gr1/repo_in_group""")
+            response.mustcontain("gr1/repo_in_group")
         finally:
             RepoModel().delete('gr1/repo_in_group')
             ReposGroupModel().delete(repos_group='gr1', force_delete=True)
@@ -95,8 +98,8 @@
     def test_index_page_on_groups_with_lightweight_dashboard(self):
         self.log_user()
         self._set_l_dash(True)
-        _make_repo(name='gr1/repo_in_group', repos_group=_make_group('gr1'))
-        Session().commit()
+        fixture.create_repo(name='gr1/repo_in_group',
+                            repos_group=fixture.create_group('gr1'))
         response = self.app.get(url('repos_group_home', group_name='gr1'))
 
         try: