|
5 | 5 | from django.conf import settings as django_conf_settings |
6 | 6 |
|
7 | 7 | from rest_framework import fields |
8 | | -from rest_framework.exceptions import ValidationError |
9 | 8 |
|
10 | 9 | from api.base import utils as api_utils |
11 | 10 | from osf.models.base import coerce_guid, Guid, GuidMixin, OptionalGuidMixin, VersionedGuidMixin, InvalidGuid |
@@ -63,47 +62,6 @@ def test_push_status_message_no_response(self): |
63 | 62 | except BaseException: |
64 | 63 | assert False, f'Exception from push_status_message via API v2 with type "{status}".' |
65 | 64 |
|
66 | | - def test_push_status_message_expected_error(self): |
67 | | - status_message = 'This is a message' |
68 | | - try: |
69 | | - push_status_message(status_message, kind='error') |
70 | | - assert False, 'push_status_message() should have generated a ValidationError exception.' |
71 | | - |
72 | | - except ValidationError as e: |
73 | | - assert ( |
74 | | - e.detail[0] == status_message |
75 | | - ), 'push_status_message() should have passed along the message with the Exception.' |
76 | | - |
77 | | - except RuntimeError: |
78 | | - assert False, 'push_status_message() should have caught the runtime error and replaced it.' |
79 | | - |
80 | | - except BaseException: |
81 | | - assert False, 'Exception from push_status_message when called from the v2 API with type "error"' |
82 | | - |
83 | | - @mock.patch('framework.status.get_session') |
84 | | - def test_push_status_message_unexpected_error(self, mock_get_session): |
85 | | - status_message = 'This is a message' |
86 | | - exception_message = 'this is some very unexpected problem' |
87 | | - mock_session = mock.Mock() |
88 | | - mock_session.attach_mock(mock.Mock(side_effect=RuntimeError(exception_message)), 'get') |
89 | | - mock_get_session.return_value = mock_session |
90 | | - try: |
91 | | - push_status_message(status_message, kind='error') |
92 | | - assert False, 'push_status_message() should have generated a RuntimeError exception.' |
93 | | - except ValidationError: |
94 | | - assert False, 'push_status_message() should have re-raised the RuntimeError not gotten ValidationError.' |
95 | | - except RuntimeError as e: |
96 | | - assert str(e) == exception_message, ( |
97 | | - 'push_status_message() should have re-raised the ' |
98 | | - 'original RuntimeError with the original message.' |
99 | | - ) |
100 | | - |
101 | | - except BaseException: |
102 | | - assert False, ( |
103 | | - 'Unexpected Exception from push_status_message when called ' |
104 | | - 'from the v2 API with type "error"' |
105 | | - ) |
106 | | - |
107 | 65 |
|
108 | 66 | @pytest.mark.django_db |
109 | 67 | class TestCoerceGuid: |
|
0 commit comments