Code Duplication    Length = 46-46 lines in 2 locations

django-data/image/submissions/tests/test_view_batch_update.py 1 location

@@ 161-206 (lines=46) @@
158
        self.redirect_url = reverse('submissions:detail', kwargs={'pk': 1})
159
160
161
class FixValidationMixin(
162
        SubmissionDataMixin, GeneralMixinTestCase):
163
164
    def tearDown(self):
165
        self.batch_update_patcher.stop()
166
167
        super().tearDown()
168
169
    def test_ownership(self):
170
        """Test a non-owner having a 404 response"""
171
172
        client = Client()
173
        client.login(username='test2', password='test2')
174
175
        response = client.post(
176
            self.url,
177
            self.data,
178
            follow=True
179
        )
180
181
        self.assertEqual(response.status_code, 404)
182
183
    def test_redirect(self):
184
        url = reverse('submissions:detail', kwargs={'pk': 1})
185
        self.assertRedirects(self.response, url)
186
187
    def test_update(self):
188
        """Asserting task called"""
189
190
        self.assertTrue(self.batch_update.called)
191
192
        self.submission.refresh_from_db()
193
194
        self.assertEqual(self.submission.status, WAITING)
195
        self.assertEqual(
196
            self.submission.message,
197
            "waiting for data updating")
198
199
    def test_message(self):
200
        """Assert message"""
201
202
        # check messages (defined in common.tests.MessageMixinTestCase
203
        self.check_messages(
204
            self.response,
205
            "warning",
206
            "waiting for data updating")
207
208
209
class SuccessfulFixValidationAnimalTest(

django-data/image/submissions/tests/test_view_batch_delete.py 1 location

@@ 114-159 (lines=46) @@
111
        self.redirect_url = reverse('submissions:detail', kwargs={'pk': 1})
112
113
114
class BatchDeleteMixin(
115
        SubmissionDataMixin, GeneralMixinTestCase):
116
117
    def tearDown(self):
118
        self.batch_delete_patcher.stop()
119
120
        super().tearDown()
121
122
    def test_ownership(self):
123
        """Test a non-owner having a 404 response"""
124
125
        client = Client()
126
        client.login(username='test2', password='test2')
127
128
        response = client.post(
129
            self.url,
130
            self.data,
131
            follow=True
132
        )
133
134
        self.assertEqual(response.status_code, 404)
135
136
    def test_redirect(self):
137
        url = reverse('submissions:detail', kwargs={'pk': 1})
138
        self.assertRedirects(self.response, url)
139
140
    def test_delete(self):
141
        """Asserting task called"""
142
143
        self.assertTrue(self.batch_delete.called)
144
145
        self.submission.refresh_from_db()
146
147
        self.assertEqual(self.submission.status, WAITING)
148
        self.assertEqual(
149
            self.submission.message,
150
            "waiting for batch delete to complete")
151
152
    def test_message(self):
153
        """Assert message"""
154
155
        # check messages (defined in common.tests.MessageMixinTestCase
156
        self.check_messages(
157
            self.response,
158
            "warning",
159
            "waiting for batch delete to complete")
160
161
162
class SuccessfulDeleteAnimalsViewTest(