Example #1
0
 def test_mark_positive_user_precondition(self):
     """
     It tests that a new user is not positive
     """
     # an operator
     user = create_user_on_db()
     assert user is not None
     assert user.role_id is 3
     positive = positive_with_user_id(user.id, marked=True)
     assert positive is None
     delete_positive_with_user_id(user.id)
     del_user_on_db(user.id)
Example #2
0
 def test_mark_positive_user_by_phone(self):
     """
     It tests that health authority can mark a customer as covid-19
     positive using only the customer's phone number
     """
     user = create_user_on_db()
     assert user is not None
     positive = positive_with_user_id(user.id)
     assert positive is None
     message = HealthyServices.mark_positive("", user.phone)
     assert len(message) is 0
     delete_positive_with_user_id(user.id)
     del_user_on_db(user.id)
Example #3
0
 def test_mark_positive_user_by_email(self):
     """
     It tests that health authority can mark a customer as covid-19
     positive using only the customer's email
     """
     user = create_user_on_db()
     assert user is not None
     assert user.role_id is 3
     assert user is not None
     positive = positive_with_user_id(user.id)
     assert positive is None
     message = HealthyServices.mark_positive(user.email, "")
     assert len(message) is 0
     delete_positive_with_user_id(user.id)
     del_user_on_db(user.id)
Example #4
0
 def test_mark_positive_ok(self):
     """
     It tests that a user is correctly marked as covid-19 positive by
     health authority
     """
     # an operator
     user = create_user_on_db()
     assert user is not None
     assert user.role_id is 3
     positive = positive_with_user_id(user.id)
     assert positive is None
     message = HealthyServices.mark_positive(user.email, user.phone)
     assert len(message) is 0
     delete_positive_with_user_id(user.id)
     del_user_on_db(user.id)
Example #5
0
    def test_unmark_user_not_positive(self):
        """
        It tests that health authority cannot mark a customer as healed
        if the customer is not covid-19 positive
        """
        user = create_user_on_db()
        assert user is not None
        assert user.role_id is 3

        message = HealthyServices.unmark_positive(user.email, user.phone)
        assert message == "User with email {} is not Covid-19 positive".format(
            user.email)

        delete_positive_with_user_id(user.id)
        del_user_on_db(user.id)
Example #6
0
 def test_mark_positive_already_covid(self):
     """
     It tests that a customer can't be marked as covid-19 positive if
     he is already covid-19 positive
     """
     user = create_user_on_db()
     assert user is not None
     assert user.role_id is 3
     positive = positive_with_user_id(user.id)
     assert positive is None
     message = HealthyServices.mark_positive(user.email, user.phone)
     assert len(message) is 0
     message = HealthyServices.mark_positive(user.email, user.phone)
     assert message == "User with email {} already Covid-19 positive".format(
         user.email)
     delete_positive_with_user_id(user.id)
     del_user_on_db(user.id)