86_User_suggestions_and_feedback #111
@ -74,6 +74,9 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
self.assertEqual(obj.identifier, test_id)
|
self.assertEqual(obj.identifier, test_id)
|
||||||
self.assertEqual(obj.title, test_title)
|
self.assertEqual(obj.title, test_title)
|
||||||
self.assert_equal_geometries(obj.geometry.geom, test_geom)
|
self.assert_equal_geometries(obj.geometry.geom, test_geom)
|
||||||
|
self.assertEqual(1, obj.log.count())
|
||||||
|
self.assertEqual(obj.log.first().action, UserAction.CREATED)
|
||||||
|
self.assertEqual(obj.log.first().user, self.superuser)
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
# Fail if there is no such object
|
# Fail if there is no such object
|
||||||
self.fail()
|
self.fail()
|
||||||
@ -215,6 +218,8 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
# Make sure there are no payments on the intervention, yet
|
# Make sure there are no payments on the intervention, yet
|
||||||
self.assertEqual(0, self.intervention.payments.count())
|
self.assertEqual(0, self.intervention.payments.count())
|
||||||
|
|
||||||
|
pre_payment_logs_count = self.intervention.log.count()
|
||||||
|
|
||||||
# Create form data to be sent to the url
|
# Create form data to be sent to the url
|
||||||
test_amount = 10.00
|
test_amount = 10.00
|
||||||
test_due = "2021-01-01"
|
test_due = "2021-01-01"
|
||||||
@ -239,6 +244,10 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
self.assertEqual(payment.amount, test_amount)
|
self.assertEqual(payment.amount, test_amount)
|
||||||
self.assertEqual(payment.due_on, datetime.date.fromisoformat(test_due))
|
self.assertEqual(payment.due_on, datetime.date.fromisoformat(test_due))
|
||||||
self.assertEqual(payment.comment, test_comment)
|
self.assertEqual(payment.comment, test_comment)
|
||||||
|
|
||||||
|
# Make sure a log entry has been created
|
||||||
|
self.assertEqual(self.intervention.log.first().action, UserAction.EDITED)
|
||||||
|
self.assertEqual(pre_payment_logs_count + 1, self.intervention.log.count())
|
||||||
return payment
|
return payment
|
||||||
|
|
||||||
def subtest_delete_payment(self, payment: Payment):
|
def subtest_delete_payment(self, payment: Payment):
|
||||||
@ -250,6 +259,8 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
pre_payment_logs_count = self.intervention.log.count()
|
||||||
|
|
||||||
# Create removing url for the payment
|
# Create removing url for the payment
|
||||||
remove_url = reverse("compensation:pay:remove", args=(payment.id,))
|
remove_url = reverse("compensation:pay:remove", args=(payment.id,))
|
||||||
post_data = {
|
post_data = {
|
||||||
@ -266,6 +277,11 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
# Now make sure the intervention has no payments anymore
|
# Now make sure the intervention has no payments anymore
|
||||||
self.assertEqual(0, self.intervention.payments.count())
|
self.assertEqual(0, self.intervention.payments.count())
|
||||||
|
|
||||||
|
# Make sure a log entry has been created
|
||||||
|
self.assertEqual(self.intervention.log.first().action, UserAction.EDITED)
|
||||||
|
self.assertEqual(self.intervention.log.first().user, self.superuser)
|
||||||
|
self.assertEqual(pre_payment_logs_count + 1, self.intervention.log.count())
|
||||||
|
|
||||||
def test_payments(self):
|
def test_payments(self):
|
||||||
"""
|
"""
|
||||||
Checks a 'normal' case of adding a payment.
|
Checks a 'normal' case of adding a payment.
|
||||||
@ -353,6 +369,8 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
pre_deduction_logs_count = self.intervention.log.count()
|
||||||
|
|
||||||
# Prepare the account for a working situation (enough deductable surface, recorded and shared)
|
# Prepare the account for a working situation (enough deductable surface, recorded and shared)
|
||||||
self.eco_account.deductable_surface = 10000.00
|
self.eco_account.deductable_surface = 10000.00
|
||||||
if self.eco_account.recorded is None:
|
if self.eco_account.recorded is None:
|
||||||
@ -376,6 +394,11 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
)
|
)
|
||||||
self.assertEqual(deduction.surface, test_surface)
|
self.assertEqual(deduction.surface, test_surface)
|
||||||
|
|
||||||
|
# Make sure a log entry has been created
|
||||||
|
self.assertEqual(self.intervention.log.first().action, UserAction.EDITED)
|
||||||
|
self.assertEqual(self.intervention.log.first().user, self.superuser)
|
||||||
|
self.assertEqual(pre_deduction_logs_count + 1, self.intervention.log.count())
|
||||||
|
|
||||||
# Return deduction for further usage in tests
|
# Return deduction for further usage in tests
|
||||||
return deduction
|
return deduction
|
||||||
|
|
||||||
@ -414,6 +437,8 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
pre_delete_logs_count = self.intervention.log.count()
|
||||||
|
|
||||||
# Prepare url for deleting of this deduction
|
# Prepare url for deleting of this deduction
|
||||||
delete_url = reverse("compensation:acc:remove-deduction", args=(self.eco_account.id, deduction.id,))
|
delete_url = reverse("compensation:acc:remove-deduction", args=(self.eco_account.id, deduction.id,))
|
||||||
post_data = {
|
post_data = {
|
||||||
@ -433,6 +458,11 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
# Expect the deduction to be totally gone
|
# Expect the deduction to be totally gone
|
||||||
self.assert_object_is_deleted(deduction)
|
self.assert_object_is_deleted(deduction)
|
||||||
|
|
||||||
|
# Make sure a log entry has been created
|
||||||
|
self.assertEqual(self.intervention.log.first().action, UserAction.EDITED)
|
||||||
|
self.assertEqual(self.intervention.log.first().user, self.superuser)
|
||||||
|
self.assertEqual(pre_delete_logs_count + 1, self.intervention.log.count())
|
||||||
|
|
||||||
def test_deduction(self):
|
def test_deduction(self):
|
||||||
"""
|
"""
|
||||||
Checks a 'normal case of adding a deduction.
|
Checks a 'normal case of adding a deduction.
|
||||||
|
Loading…
Reference in New Issue
Block a user