##// END OF EJS Templates
tests: fixed few possible cases of detached instance errors.
marcink -
r1902:9b3b9a29 default
parent child Browse files
Show More
@@ -22,6 +22,7 b' import mock'
22 import pytest
22 import pytest
23
23
24 import rhodecode
24 import rhodecode
25 from rhodecode.model.db import Repository
25 from rhodecode.model.settings import SettingsModel
26 from rhodecode.model.settings import SettingsModel
26 from rhodecode.tests import url
27 from rhodecode.tests import url
27 from rhodecode.tests.utils import AssertResponse
28 from rhodecode.tests.utils import AssertResponse
@@ -87,10 +88,11 b' class TestAdminRepoVcsSettings(object):'
87 pytest.skip('Setting not available for backend {}'.format(backend))
88 pytest.skip('Setting not available for backend {}'.format(backend))
88
89
89 repo = backend.create_repo()
90 repo = backend.create_repo()
91 repo_name = repo.repo_name
90
92
91 settings_model = SettingsModel(repo=repo)
93 settings_model = SettingsModel(repo=repo)
92 vcs_settings_url = url(
94 vcs_settings_url = url(
93 'repo_vcs_settings', repo_name=repo.repo_name)
95 'repo_vcs_settings', repo_name=repo_name)
94
96
95 self.app.post(
97 self.app.post(
96 vcs_settings_url,
98 vcs_settings_url,
@@ -101,6 +103,7 b' class TestAdminRepoVcsSettings(object):'
101 'rhodecode_{}'.format(setting_name): 'true',
103 'rhodecode_{}'.format(setting_name): 'true',
102 'csrf_token': csrf_token,
104 'csrf_token': csrf_token,
103 })
105 })
106 settings_model = SettingsModel(repo=Repository.get_by_repo_name(repo_name))
104 setting = settings_model.get_setting_by_name(setting_name)
107 setting = settings_model.get_setting_by_name(setting_name)
105 assert setting.app_settings_value
108 assert setting.app_settings_value
106
109
@@ -113,5 +116,6 b' class TestAdminRepoVcsSettings(object):'
113 'rhodecode_{}'.format(setting_name): 'false',
116 'rhodecode_{}'.format(setting_name): 'false',
114 'csrf_token': csrf_token,
117 'csrf_token': csrf_token,
115 })
118 })
119 settings_model = SettingsModel(repo=Repository.get_by_repo_name(repo_name))
116 setting = settings_model.get_setting_by_name(setting_name)
120 setting = settings_model.get_setting_by_name(setting_name)
117 assert not setting.app_settings_value
121 assert not setting.app_settings_value
@@ -21,6 +21,7 b''
21 import pytest
21 import pytest
22
22
23 from rhodecode.lib.utils2 import md5
23 from rhodecode.lib.utils2 import md5
24 from rhodecode.model.db import Repository
24 from rhodecode.model.meta import Session
25 from rhodecode.model.meta import Session
25 from rhodecode.model.settings import SettingsModel, IssueTrackerSettingsModel
26 from rhodecode.model.settings import SettingsModel, IssueTrackerSettingsModel
26 from rhodecode.tests import url
27 from rhodecode.tests import url
@@ -100,6 +101,7 b' class TestAdminRepos:'
100 def test_delete_issuetracker_pattern(
101 def test_delete_issuetracker_pattern(
101 self, autologin_user, backend, csrf_token, settings_util):
102 self, autologin_user, backend, csrf_token, settings_util):
102 repo = backend.create_repo()
103 repo = backend.create_repo()
104 repo_name = repo.repo_name
103 entry_key = 'issuetracker_pat_'
105 entry_key = 'issuetracker_pat_'
104 pattern = 'issuetracker_pat3'
106 pattern = 'issuetracker_pat3'
105 uid = md5(pattern)
107 uid = md5(pattern)
@@ -115,5 +117,6 b' class TestAdminRepos:'
115 'uid': uid,
117 'uid': uid,
116 'csrf_token': csrf_token
118 'csrf_token': csrf_token
117 }, status=302)
119 }, status=302)
118 settings = IssueTrackerSettingsModel(repo=repo).get_repo_settings()
120 settings = IssueTrackerSettingsModel(
121 repo=Repository.get_by_repo_name(repo_name)).get_repo_settings()
119 assert 'rhodecode_%s%s' % (entry_key, uid) not in settings
122 assert 'rhodecode_%s%s' % (entry_key, uid) not in settings
General Comments 0
You need to be logged in to leave comments. Login now