|
| 1 | +import warnings |
| 2 | + |
1 | 3 | from . import mock, BaseRedmineTestCase |
2 | 4 | from .responses import responses |
3 | 5 |
|
@@ -120,7 +122,11 @@ def test_create_resource_with_stream_uploads(self): |
120 | 122 | 'issue': {'subject': 'Foo', 'project_id': 1, 'id': 1} |
121 | 123 | } |
122 | 124 | stream = StringIO(b'\xcf\x86oo'.decode('utf8')) |
123 | | - issue = self.redmine.issue.create(project_id=1, subject='Foo', uploads=[{'path': stream}]) |
| 125 | + with warnings.catch_warnings(record=True) as w: |
| 126 | + warnings.simplefilter('always') |
| 127 | + issue = self.redmine.issue.create(project_id=1, subject='Foo', uploads=[{'path': stream}]) |
| 128 | + self.assertEquals(len(w), 1) |
| 129 | + self.assertIs(w[0].category, exceptions.PerformanceWarning) |
124 | 130 | self.assertEqual(issue.project_id, 1) |
125 | 131 | self.assertEqual(issue.subject, 'Foo') |
126 | 132 |
|
@@ -153,7 +159,11 @@ def test_update_resource_with_stream_uploads(self): |
153 | 159 | mock.Mock(status_code=200, history=[], content='') |
154 | 160 | ]) |
155 | 161 | stream = StringIO(b'\xcf\x86oo'.decode('utf8')) |
156 | | - self.assertEqual(self.redmine.issue.update(1, subject='Bar', uploads=[{'path': stream}]), True) |
| 162 | + with warnings.catch_warnings(record=True) as w: |
| 163 | + warnings.simplefilter('always') |
| 164 | + self.assertEqual(self.redmine.issue.update(1, subject='Bar', uploads=[{'path': stream}]), True) |
| 165 | + self.assertEquals(len(w), 1) |
| 166 | + self.assertIs(w[0].category, exceptions.PerformanceWarning) |
157 | 167 |
|
158 | 168 | def test_delete_resource(self): |
159 | 169 | self.response.content = '' |
|
0 commit comments