| @@ 247-290 (lines=44) @@ | ||
| 244 | self.attribute_to_edit) |
|
| 245 | ||
| 246 | ||
| 247 | class SuccessfulFixValidationSampleTest( |
|
| 248 | FixValidationMixin, TestCase): |
|
| 249 | ||
| 250 | def setUp(self): |
|
| 251 | """call base method""" |
|
| 252 | ||
| 253 | # call base method |
|
| 254 | super().setUp() |
|
| 255 | ||
| 256 | # defining patcher |
|
| 257 | self.batch_update_patcher = patch( |
|
| 258 | 'samples.tasks.BatchUpdateSamples.delay') |
|
| 259 | self.batch_update = self.batch_update_patcher.start() |
|
| 260 | ||
| 261 | # setting attribute |
|
| 262 | self.attribute_to_edit = 'collection_place' |
|
| 263 | ||
| 264 | self.url = reverse( |
|
| 265 | 'submissions:fix_validation', |
|
| 266 | kwargs={ |
|
| 267 | 'pk': 1, |
|
| 268 | 'record_type': 'sample', |
|
| 269 | 'attribute_to_edit': self.attribute_to_edit}) |
|
| 270 | ||
| 271 | self.data = {'to_edit1': 'Meow'} |
|
| 272 | ||
| 273 | # get a response |
|
| 274 | self.response = self.client.post( |
|
| 275 | self.url, |
|
| 276 | self.data, |
|
| 277 | follow=True |
|
| 278 | ) |
|
| 279 | ||
| 280 | def test_url_resolves_view(self): |
|
| 281 | view = resolve( |
|
| 282 | '/submissions/1/fix_validation/sample/collection_place/') |
|
| 283 | self.assertIsInstance(view.func.view_class(), FixValidation) |
|
| 284 | ||
| 285 | def test_called_args(self): |
|
| 286 | """Testing used arguments""" |
|
| 287 | self.batch_update.assert_called_with( |
|
| 288 | str(self.submission.id), |
|
| 289 | {1: "Meow"}, |
|
| 290 | self.attribute_to_edit) |
|
| 291 | ||
| @@ 202-244 (lines=43) @@ | ||
| 199 | "waiting for data updating") |
|
| 200 | ||
| 201 | ||
| 202 | class SuccessfulFixValidationAnimalTest( |
|
| 203 | FixValidationMixin, TestCase): |
|
| 204 | ||
| 205 | def setUp(self): |
|
| 206 | """call base method""" |
|
| 207 | ||
| 208 | # call base method |
|
| 209 | super().setUp() |
|
| 210 | ||
| 211 | # defining patcher |
|
| 212 | self.batch_update_patcher = patch( |
|
| 213 | 'animals.tasks.BatchUpdateAnimals.delay') |
|
| 214 | self.batch_update = self.batch_update_patcher.start() |
|
| 215 | ||
| 216 | # setting attribute |
|
| 217 | self.attribute_to_edit = 'birth_location' |
|
| 218 | ||
| 219 | self.url = reverse( |
|
| 220 | 'submissions:fix_validation', |
|
| 221 | kwargs={ |
|
| 222 | 'pk': 1, |
|
| 223 | 'record_type': 'animal', |
|
| 224 | 'attribute_to_edit': self.attribute_to_edit}) |
|
| 225 | ||
| 226 | self.data = {'to_edit1': 'Meow'} |
|
| 227 | ||
| 228 | # get a response |
|
| 229 | self.response = self.client.post( |
|
| 230 | self.url, |
|
| 231 | self.data, |
|
| 232 | follow=True |
|
| 233 | ) |
|
| 234 | ||
| 235 | def test_url_resolves_view(self): |
|
| 236 | view = resolve('/submissions/1/fix_validation/animal/birth_location/') |
|
| 237 | self.assertIsInstance(view.func.view_class(), FixValidation) |
|
| 238 | ||
| 239 | def test_called_args(self): |
|
| 240 | """Testing used arguments""" |
|
| 241 | self.batch_update.assert_called_with( |
|
| 242 | str(self.submission.id), |
|
| 243 | {1: "Meow"}, |
|
| 244 | self.attribute_to_edit) |
|
| 245 | ||
| 246 | ||
| 247 | class SuccessfulFixValidationSampleTest( |
|