Code Duplication    Length = 46-46 lines in 2 locations

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

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

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

@@ 88-133 (lines=46) @@
85
        self.assertContains(self.response, 'href="{0}"'.format(link))
86
87
88
class BatchDeleteMixin(
89
        SubmissionDataMixin, GeneralMixinTestCase):
90
91
    def tearDown(self):
92
        self.batch_delete_patcher.stop()
93
94
        super().tearDown()
95
96
    def test_ownership(self):
97
        """Test a non-owner having a 404 response"""
98
99
        client = Client()
100
        client.login(username='test2', password='test2')
101
102
        response = client.post(
103
            self.url,
104
            self.data,
105
            follow=True
106
        )
107
108
        self.assertEqual(response.status_code, 404)
109
110
    def test_redirect(self):
111
        url = reverse('submissions:detail', kwargs={'pk': 1})
112
        self.assertRedirects(self.response, url)
113
114
    def test_delete(self):
115
        """Asserting task called"""
116
117
        self.assertTrue(self.batch_delete.called)
118
119
        self.submission.refresh_from_db()
120
121
        self.assertEqual(self.submission.status, WAITING)
122
        self.assertEqual(
123
            self.submission.message,
124
            "waiting for batch delete to complete")
125
126
    def test_message(self):
127
        """Assert message"""
128
129
        # check messages (defined in common.tests.MessageMixinTestCase
130
        self.check_messages(
131
            self.response,
132
            "warning",
133
            "waiting for batch delete to complete")
134
135
136
class SuccessfulDeleteAnimalsViewTest(