|
@@ 103-126 (lines=24) @@
|
| 100 |
|
'sample_unkn': 0, 'animal_issues': 0, 'sample_issues': 0} |
| 101 |
|
) |
| 102 |
|
|
| 103 |
|
def test_delete_animal_not_exists(self): |
| 104 |
|
# calling task and delete a animal |
| 105 |
|
res = self.my_task.run( |
| 106 |
|
submission_id=self.submission_id, |
| 107 |
|
animal_ids=["meow"]) |
| 108 |
|
|
| 109 |
|
self.assertEqual(res, "success") |
| 110 |
|
|
| 111 |
|
# all animals remain |
| 112 |
|
n_animals = Animal.objects.count() |
| 113 |
|
self.assertEqual(n_animals, 3) |
| 114 |
|
|
| 115 |
|
# updating validation messages |
| 116 |
|
|
| 117 |
|
# calling a WebSocketMixin method |
| 118 |
|
# no validation message since no data in validation table |
| 119 |
|
self.check_message( |
| 120 |
|
message=STATUSES.get_value_display(NEED_REVISION), |
| 121 |
|
notification_message=( |
| 122 |
|
"You've removed 0 animals. It wasn't possible to find records " |
| 123 |
|
"with these ids: meow. Rerun validation please!"), |
| 124 |
|
validation_message={ |
| 125 |
|
'animals': 3, 'samples': 1, 'animal_unkn': 3, |
| 126 |
|
'sample_unkn': 1, 'animal_issues': 0, 'sample_issues': 0} |
| 127 |
|
) |
| 128 |
|
|
| 129 |
|
|
|
@@ 77-100 (lines=24) @@
|
| 74 |
|
message='Error', |
| 75 |
|
notification_message='Error in animal batch delete: Test') |
| 76 |
|
|
| 77 |
|
def test_delete_animal(self): |
| 78 |
|
# calling task and delete a animal |
| 79 |
|
res = self.my_task.run( |
| 80 |
|
submission_id=self.submission_id, |
| 81 |
|
animal_ids=self.animal_ids) |
| 82 |
|
|
| 83 |
|
self.assertEqual(res, "success") |
| 84 |
|
|
| 85 |
|
# no animals |
| 86 |
|
n_animals = Animal.objects.count() |
| 87 |
|
self.assertEqual(n_animals, 0) |
| 88 |
|
|
| 89 |
|
# updating validation messages |
| 90 |
|
|
| 91 |
|
# calling a WebSocketMixin method |
| 92 |
|
# no validation message since no data in validation table |
| 93 |
|
self.check_message( |
| 94 |
|
message=STATUSES.get_value_display(NEED_REVISION), |
| 95 |
|
notification_message=( |
| 96 |
|
"You've removed %s " |
| 97 |
|
"animals. Rerun validation please!" % len(self.animal_ids)), |
| 98 |
|
validation_message={ |
| 99 |
|
'animals': 0, 'samples': 0, 'animal_unkn': 0, |
| 100 |
|
'sample_unkn': 0, 'animal_issues': 0, 'sample_issues': 0} |
| 101 |
|
) |
| 102 |
|
|
| 103 |
|
def test_delete_animal_not_exists(self): |