##// END OF EJS Templates
exceptions: fixed py3 incompatible calls
marcink -
r3108:ed4aee63 default
parent child Browse files
Show More
@@ -49,7 +49,7 b' class TestIssueTrackerSettingsModel(obje'
49 model = IssueTrackerSettingsModel()
49 model = IssueTrackerSettingsModel()
50 with pytest.raises(Exception) as exc_info:
50 with pytest.raises(Exception) as exc_info:
51 model.get_repo_settings(cache=True)
51 model.get_repo_settings(cache=True)
52 assert exc_info.value.message == 'Repository is not specified'
52 assert str(exc_info.value) == 'Repository is not specified'
53
53
54 def test_get_repo_settings(self, repo_stub):
54 def test_get_repo_settings(self, repo_stub):
55 model = IssueTrackerSettingsModel(repo=repo_stub.repo_name)
55 model = IssueTrackerSettingsModel(repo=repo_stub.repo_name)
@@ -491,7 +491,7 b' class TestDeleteUiValue(object):'
491 model = SettingsModel()
491 model = SettingsModel()
492 with pytest.raises(SettingNotFound) as exc_info:
492 with pytest.raises(SettingNotFound) as exc_info:
493 model.delete_ui(id_)
493 model.delete_ui(id_)
494 assert exc_info.value.message == 'Setting `{}` is not found'.format(id_)
494 assert str(exc_info.value) == 'Setting `{}` is not found'.format(id_)
495
495
496 def test_delete_ui_when_repo_is_not_set(self, settings_util):
496 def test_delete_ui_when_repo_is_not_set(self, settings_util):
497 model = SettingsModel()
497 model = SettingsModel()
@@ -53,7 +53,7 b' class TestInheritGlobalSettingsProperty('
53 model = VcsSettingsModel()
53 model = VcsSettingsModel()
54 with pytest.raises(Exception) as exc_info:
54 with pytest.raises(Exception) as exc_info:
55 model.inherit_global_settings
55 model.inherit_global_settings
56 assert exc_info.value.message == 'Repository is not specified'
56 assert str(exc_info.value) == 'Repository is not specified'
57
57
58 def test_true_is_returned_when_value_is_not_found(self, repo_stub):
58 def test_true_is_returned_when_value_is_not_found(self, repo_stub):
59 model = VcsSettingsModel(repo=repo_stub.repo_name)
59 model = VcsSettingsModel(repo=repo_stub.repo_name)
@@ -81,7 +81,7 b' class TestInheritGlobalSettingsProperty('
81 model = VcsSettingsModel()
81 model = VcsSettingsModel()
82 with pytest.raises(Exception) as exc_info:
82 with pytest.raises(Exception) as exc_info:
83 model.inherit_global_settings = False
83 model.inherit_global_settings = False
84 assert exc_info.value.message == 'Repository is not specified'
84 assert str(exc_info.value) == 'Repository is not specified'
85
85
86
86
87 class TestVcsSettingsModel(object):
87 class TestVcsSettingsModel(object):
@@ -114,7 +114,7 b' class TestVcsSettingsModel(object):'
114 model = VcsSettingsModel()
114 model = VcsSettingsModel()
115 with pytest.raises(Exception) as exc_info:
115 with pytest.raises(Exception) as exc_info:
116 model.get_repo_svn_branch_patterns()
116 model.get_repo_svn_branch_patterns()
117 assert exc_info.value.message == 'Repository is not specified'
117 assert str(exc_info.value) == 'Repository is not specified'
118
118
119 def test_global_svn_tag_patterns(self):
119 def test_global_svn_tag_patterns(self):
120 model = VcsSettingsModel()
120 model = VcsSettingsModel()
@@ -144,7 +144,7 b' class TestVcsSettingsModel(object):'
144 model = VcsSettingsModel()
144 model = VcsSettingsModel()
145 with pytest.raises(Exception) as exc_info:
145 with pytest.raises(Exception) as exc_info:
146 model.get_repo_svn_tag_patterns()
146 model.get_repo_svn_tag_patterns()
147 assert exc_info.value.message == 'Repository is not specified'
147 assert str(exc_info.value) == 'Repository is not specified'
148
148
149 def test_get_global_settings(self):
149 def test_get_global_settings(self):
150 expected_result = {'test': 'test'}
150 expected_result = {'test': 'test'}
@@ -277,9 +277,8 b' class TestCreateOrUpdateRepoHookSettings'
277
277
278 with pytest.raises(ValueError) as exc_info:
278 with pytest.raises(ValueError) as exc_info:
279 model.create_or_update_repo_hook_settings(data)
279 model.create_or_update_repo_hook_settings(data)
280 assert (
280 msg = 'The given data does not contain {} key'.format(deleted_key)
281 exc_info.value.message ==
281 assert str(exc_info.value) == msg
282 'The given data does not contain {} key'.format(deleted_key))
283
282
284 def test_update_when_repo_object_found(self, repo_stub, settings_util):
283 def test_update_when_repo_object_found(self, repo_stub, settings_util):
285 model = VcsSettingsModel(repo=repo_stub.repo_name)
284 model = VcsSettingsModel(repo=repo_stub.repo_name)
@@ -310,9 +309,8 b' class TestUpdateGlobalHookSettings(objec'
310
309
311 with pytest.raises(ValueError) as exc_info:
310 with pytest.raises(ValueError) as exc_info:
312 model.update_global_hook_settings(data)
311 model.update_global_hook_settings(data)
313 assert (
312 msg = 'The given data does not contain {} key'.format(deleted_key)
314 exc_info.value.message ==
313 assert str(exc_info.value) == msg
315 'The given data does not contain {} key'.format(deleted_key))
316
314
317 def test_update_global_hook_settings(self, settings_util):
315 def test_update_global_hook_settings(self, settings_util):
318 model = VcsSettingsModel()
316 model = VcsSettingsModel()
@@ -342,7 +340,7 b' class TestCreateOrUpdateRepoGeneralSetti'
342 model = VcsSettingsModel()
340 model = VcsSettingsModel()
343 with pytest.raises(Exception) as exc_info:
341 with pytest.raises(Exception) as exc_info:
344 model.create_or_update_repo_pr_settings(GENERAL_FORM_DATA)
342 model.create_or_update_repo_pr_settings(GENERAL_FORM_DATA)
345 assert exc_info.value.message == 'Repository is not specified'
343 assert str(exc_info.value) == 'Repository is not specified'
346
344
347
345
348 class TestCreateOrUpdatGlobalGeneralSettings(object):
346 class TestCreateOrUpdatGlobalGeneralSettings(object):
@@ -382,9 +380,9 b' class TestCreateOrUpdateGeneralSettings('
382
380
383 with pytest.raises(ValueError) as exc_info:
381 with pytest.raises(ValueError) as exc_info:
384 model._create_or_update_general_settings(model.repo_settings, data)
382 model._create_or_update_general_settings(model.repo_settings, data)
385 assert (
383
386 exc_info.value.message ==
384 msg = 'The given data does not contain {} key'.format(deleted_key)
387 'The given data does not contain {} key'.format(deleted_key))
385 assert str(exc_info.value) == msg
388
386
389 def test_update_when_repo_setting_found(self, repo_stub, settings_util):
387 def test_update_when_repo_setting_found(self, repo_stub, settings_util):
390 model = VcsSettingsModel(repo=repo_stub.repo_name)
388 model = VcsSettingsModel(repo=repo_stub.repo_name)
@@ -411,7 +409,7 b' class TestCreateRepoSvnSettings(object):'
411 model = VcsSettingsModel()
409 model = VcsSettingsModel()
412 with pytest.raises(Exception) as exc_info:
410 with pytest.raises(Exception) as exc_info:
413 model.create_repo_svn_settings(SVN_FORM_DATA)
411 model.create_repo_svn_settings(SVN_FORM_DATA)
414 assert exc_info.value.message == 'Repository is not specified'
412 assert str(exc_info.value) == 'Repository is not specified'
415
413
416
414
417 class TestCreateSvnSettings(object):
415 class TestCreateSvnSettings(object):
@@ -550,13 +548,13 b' class TestCreateOrUpdateRepoHgSettings(o'
550 model.create_or_update_repo_hg_settings(data)
548 model.create_or_update_repo_hg_settings(data)
551 expected_message = 'The given data does not contain {} key'.format(
549 expected_message = 'The given data does not contain {} key'.format(
552 field_to_remove)
550 field_to_remove)
553 assert exc_info.value.message == expected_message
551 assert str(exc_info.value) == expected_message
554
552
555 def test_create_raises_exception_when_repository_not_specified(self):
553 def test_create_raises_exception_when_repository_not_specified(self):
556 model = VcsSettingsModel()
554 model = VcsSettingsModel()
557 with pytest.raises(Exception) as exc_info:
555 with pytest.raises(Exception) as exc_info:
558 model.create_or_update_repo_hg_settings(self.FORM_DATA)
556 model.create_or_update_repo_hg_settings(self.FORM_DATA)
559 assert exc_info.value.message == 'Repository is not specified'
557 assert str(exc_info.value) == 'Repository is not specified'
560
558
561
559
562 class TestUpdateGlobalSslSetting(object):
560 class TestUpdateGlobalSslSetting(object):
@@ -613,7 +611,7 b' class TestCreateOrUpdateGlobalHgSettings'
613 model.create_or_update_global_hg_settings(data)
611 model.create_or_update_global_hg_settings(data)
614 expected_message = 'The given data does not contain {} key'.format(
612 expected_message = 'The given data does not contain {} key'.format(
615 field_to_remove)
613 field_to_remove)
616 assert exc_info.value.message == expected_message
614 assert str(exc_info.value) == expected_message
617
615
618
616
619 class TestCreateOrUpdateGlobalGitSettings(object):
617 class TestCreateOrUpdateGlobalGitSettings(object):
@@ -659,7 +657,7 b' class TestDeleteRepoSvnPattern(object):'
659 model = VcsSettingsModel()
657 model = VcsSettingsModel()
660 with pytest.raises(Exception) as exc_info:
658 with pytest.raises(Exception) as exc_info:
661 model.delete_repo_svn_pattern(123)
659 model.delete_repo_svn_pattern(123)
662 assert exc_info.value.message == 'Repository is not specified'
660 assert str(exc_info.value) == 'Repository is not specified'
663
661
664
662
665 class TestDeleteGlobalSvnPattern(object):
663 class TestDeleteGlobalSvnPattern(object):
@@ -783,7 +781,7 b' class TestGetRepoUiSettings(object):'
783 model = VcsSettingsModel()
781 model = VcsSettingsModel()
784 with pytest.raises(Exception) as exc_info:
782 with pytest.raises(Exception) as exc_info:
785 model.get_repo_ui_settings()
783 model.get_repo_ui_settings()
786 assert exc_info.value.message == 'Repository is not specified'
784 assert str(exc_info.value) == 'Repository is not specified'
787
785
788
786
789 class TestGetRepoGeneralSettings(object):
787 class TestGetRepoGeneralSettings(object):
@@ -809,7 +807,7 b' class TestGetRepoGeneralSettings(object)'
809 model = VcsSettingsModel()
807 model = VcsSettingsModel()
810 with pytest.raises(Exception) as exc_info:
808 with pytest.raises(Exception) as exc_info:
811 model.get_repo_general_settings()
809 model.get_repo_general_settings()
812 assert exc_info.value.message == 'Repository is not specified'
810 assert str(exc_info.value) == 'Repository is not specified'
813
811
814
812
815 class TestGetGlobalGeneralSettings(object):
813 class TestGetGlobalGeneralSettings(object):
@@ -994,7 +992,7 b' class TestCreateOrUpdateRepoSettings(obj'
994 model = VcsSettingsModel()
992 model = VcsSettingsModel()
995 with pytest.raises(Exception) as exc_info:
993 with pytest.raises(Exception) as exc_info:
996 model.create_or_update_repo_settings(data=self.FORM_DATA)
994 model.create_or_update_repo_settings(data=self.FORM_DATA)
997 assert exc_info.value.message == 'Repository is not specified'
995 assert str(exc_info.value) == 'Repository is not specified'
998
996
999 def test_only_svn_settings_are_updated_when_type_is_svn(self, backend_svn):
997 def test_only_svn_settings_are_updated_when_type_is_svn(self, backend_svn):
1000 repo = backend_svn.create_repo()
998 repo = backend_svn.create_repo()
General Comments 0
You need to be logged in to leave comments. Login now