Changeset - b936b1c3d575
[Not reviewed]
default
0 1 0
Mads Kiilerich - 9 years ago 2016-12-19 02:52:01
mads@kiilerich.com
tests: give test_pullrequests a test_context in addition to the usual app_fixture

test_pullrequests has unit-ish tests that invoke library functions directly ...
but these happen to require localization initialized. For TG2 we only have
localization initialized when we have a test_context. Thus, additionally wrap
these tests in a test_context.
1 file changed with 9 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/functional/test_pullrequests.py
Show inline comments
 
import re
 
import pytest
 

	
 
from kallithea.tests.test_context import test_context
 

	
 
from kallithea.tests.base import *
 
from kallithea.tests.fixture import Fixture
 
from kallithea.model.db import User
 
from kallithea.model.meta import Session
 

	
 
from kallithea.controllers.pullrequests import PullrequestsController
 

	
 
fixture = Fixture()
 

	
 
class TestPullrequestsController(TestController):
 

	
 
@@ -198,24 +201,30 @@ class TestPullrequestsController(TestCon
 
                                 {
 
                                  'pullrequest_title': 'title',
 
                                  'pullrequest_desc': 'description',
 
                                  'owner': TEST_USER_ADMIN_LOGIN,
 
                                  '_authentication_token': self.authentication_token(),
 
                                  'review_members': [str(invalid_user_id)],
 
                                 },
 
                                 status=400)
 
        response.mustcontain('Invalid reviewer "%s" specified' % invalid_user_id)
 

	
 
class TestPullrequestsGetRepoRefs(TestController):
 

	
 
    # this tests need test_context in addition to app_fixture
 
    @pytest.fixture(autouse=True)
 
    def app_test_context_fixture(self, app_fixture):
 
        with test_context(self.app):
 
            yield
 

	
 
    def setup_method(self, method):
 
        self.repo_name = u'main'
 
        repo = fixture.create_repo(self.repo_name, repo_type='hg')
 
        self.repo_scm_instance = repo.scm_instance
 
        Session.commit()
 
        self.c = PullrequestsController()
 

	
 
    def teardown_method(self, method):
 
        fixture.destroy_repo(u'main')
 
        Session.commit()
 
        Session.remove()
 

	
0 comments (0 inline, 0 general)