##// 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 49 model = IssueTrackerSettingsModel()
50 50 with pytest.raises(Exception) as exc_info:
51 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 54 def test_get_repo_settings(self, repo_stub):
55 55 model = IssueTrackerSettingsModel(repo=repo_stub.repo_name)
@@ -491,7 +491,7 b' class TestDeleteUiValue(object):'
491 491 model = SettingsModel()
492 492 with pytest.raises(SettingNotFound) as exc_info:
493 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 496 def test_delete_ui_when_repo_is_not_set(self, settings_util):
497 497 model = SettingsModel()
@@ -53,7 +53,7 b' class TestInheritGlobalSettingsProperty('
53 53 model = VcsSettingsModel()
54 54 with pytest.raises(Exception) as exc_info:
55 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 58 def test_true_is_returned_when_value_is_not_found(self, repo_stub):
59 59 model = VcsSettingsModel(repo=repo_stub.repo_name)
@@ -81,7 +81,7 b' class TestInheritGlobalSettingsProperty('
81 81 model = VcsSettingsModel()
82 82 with pytest.raises(Exception) as exc_info:
83 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 87 class TestVcsSettingsModel(object):
@@ -114,7 +114,7 b' class TestVcsSettingsModel(object):'
114 114 model = VcsSettingsModel()
115 115 with pytest.raises(Exception) as exc_info:
116 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 119 def test_global_svn_tag_patterns(self):
120 120 model = VcsSettingsModel()
@@ -144,7 +144,7 b' class TestVcsSettingsModel(object):'
144 144 model = VcsSettingsModel()
145 145 with pytest.raises(Exception) as exc_info:
146 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 149 def test_get_global_settings(self):
150 150 expected_result = {'test': 'test'}
@@ -277,9 +277,8 b' class TestCreateOrUpdateRepoHookSettings'
277 277
278 278 with pytest.raises(ValueError) as exc_info:
279 279 model.create_or_update_repo_hook_settings(data)
280 assert (
281 exc_info.value.message ==
282 'The given data does not contain {} key'.format(deleted_key))
280 msg = 'The given data does not contain {} key'.format(deleted_key)
281 assert str(exc_info.value) == msg
283 282
284 283 def test_update_when_repo_object_found(self, repo_stub, settings_util):
285 284 model = VcsSettingsModel(repo=repo_stub.repo_name)
@@ -310,9 +309,8 b' class TestUpdateGlobalHookSettings(objec'
310 309
311 310 with pytest.raises(ValueError) as exc_info:
312 311 model.update_global_hook_settings(data)
313 assert (
314 exc_info.value.message ==
315 'The given data does not contain {} key'.format(deleted_key))
312 msg = 'The given data does not contain {} key'.format(deleted_key)
313 assert str(exc_info.value) == msg
316 314
317 315 def test_update_global_hook_settings(self, settings_util):
318 316 model = VcsSettingsModel()
@@ -342,7 +340,7 b' class TestCreateOrUpdateRepoGeneralSetti'
342 340 model = VcsSettingsModel()
343 341 with pytest.raises(Exception) as exc_info:
344 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 346 class TestCreateOrUpdatGlobalGeneralSettings(object):
@@ -382,9 +380,9 b' class TestCreateOrUpdateGeneralSettings('
382 380
383 381 with pytest.raises(ValueError) as exc_info:
384 382 model._create_or_update_general_settings(model.repo_settings, data)
385 assert (
386 exc_info.value.message ==
387 'The given data does not contain {} key'.format(deleted_key))
383
384 msg = 'The given data does not contain {} key'.format(deleted_key)
385 assert str(exc_info.value) == msg
388 386
389 387 def test_update_when_repo_setting_found(self, repo_stub, settings_util):
390 388 model = VcsSettingsModel(repo=repo_stub.repo_name)
@@ -411,7 +409,7 b' class TestCreateRepoSvnSettings(object):'
411 409 model = VcsSettingsModel()
412 410 with pytest.raises(Exception) as exc_info:
413 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 415 class TestCreateSvnSettings(object):
@@ -550,13 +548,13 b' class TestCreateOrUpdateRepoHgSettings(o'
550 548 model.create_or_update_repo_hg_settings(data)
551 549 expected_message = 'The given data does not contain {} key'.format(
552 550 field_to_remove)
553 assert exc_info.value.message == expected_message
551 assert str(exc_info.value) == expected_message
554 552
555 553 def test_create_raises_exception_when_repository_not_specified(self):
556 554 model = VcsSettingsModel()
557 555 with pytest.raises(Exception) as exc_info:
558 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 560 class TestUpdateGlobalSslSetting(object):
@@ -613,7 +611,7 b' class TestCreateOrUpdateGlobalHgSettings'
613 611 model.create_or_update_global_hg_settings(data)
614 612 expected_message = 'The given data does not contain {} key'.format(
615 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 617 class TestCreateOrUpdateGlobalGitSettings(object):
@@ -659,7 +657,7 b' class TestDeleteRepoSvnPattern(object):'
659 657 model = VcsSettingsModel()
660 658 with pytest.raises(Exception) as exc_info:
661 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 663 class TestDeleteGlobalSvnPattern(object):
@@ -783,7 +781,7 b' class TestGetRepoUiSettings(object):'
783 781 model = VcsSettingsModel()
784 782 with pytest.raises(Exception) as exc_info:
785 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 787 class TestGetRepoGeneralSettings(object):
@@ -809,7 +807,7 b' class TestGetRepoGeneralSettings(object)'
809 807 model = VcsSettingsModel()
810 808 with pytest.raises(Exception) as exc_info:
811 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 813 class TestGetGlobalGeneralSettings(object):
@@ -994,7 +992,7 b' class TestCreateOrUpdateRepoSettings(obj'
994 992 model = VcsSettingsModel()
995 993 with pytest.raises(Exception) as exc_info:
996 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 997 def test_only_svn_settings_are_updated_when_type_is_svn(self, backend_svn):
1000 998 repo = backend_svn.create_repo()
General Comments 0
You need to be logged in to leave comments. Login now