Skip to content

Commit

Permalink
Merge pull request #113 from openimis/release/24.10
Browse files Browse the repository at this point in the history
MERGING release/24.10 into develop
  • Loading branch information
delcroip authored Sep 19, 2024
2 parents b49a524 + b09c93f commit ccaad97
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 8 additions & 0 deletions policy/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ def set_suspended(self, user, policy):
}

def set_deleted(self, policy):

if policy.claim_ded_rems:
return {
'title': policy.uuid,
'list': [{
'message': _("policy.mutation.policy_is_used_in_claims") % {'policy': str(policy)},
'detail': policy.uuid}]
}
try:
insuree_policies = InsureePolicy.objects.filter(policy=policy)
for insuree_policy in insuree_policies:
Expand Down
10 changes: 4 additions & 6 deletions policy/tests/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,8 @@ def eligibility_serv(self, category):
native_response = native_el_svc.request(req, EligibilityResponse(req))
self.assertIsNotNone(native_response)
self.assertEquals(native_response, expected_resposnse)



def test_eligibility_item(self):
if not connection.vendor == "mssql":
self.skipTest("This test can only be executed for MSSQL database")
insuree, family = create_test_insuree_for_policy()
product = create_test_product("ELI1")
(policy, insuree_policy) = create_test_policy2(product, insuree)
Expand Down Expand Up @@ -224,8 +221,6 @@ def test_eligibility_item(self):


def test_eligibility_by_insuree(self):
if not connection.vendor == "mssql":
self.skipTest("This test can only be executed for MSSQL database")
insuree, family = create_test_insuree_for_policy()
product = create_test_product("ELI1")
(policy, insuree_policy) = create_test_policy2(product, insuree)
Expand Down Expand Up @@ -268,6 +263,9 @@ def test_eligibility_by_insuree(self):
native_response = native_el_svc.request(req, native_response)
self.assertIsNotNone(native_response)
self.assertEquals(native_response, expected_resposnse)
result = PolicyService(self.user).set_deleted(policy)
self.assertNotEquals(result, [], "the policy cannot be deleted as it has some DedRem on it")




Expand Down

0 comments on commit ccaad97

Please sign in to comment.