Skip to content

Commit

Permalink
Have test for empty address and invalid address
Browse files Browse the repository at this point in the history
  • Loading branch information
johannaengland committed Sep 5, 2023
1 parent 8d49a98 commit 7529721
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/integration/models/alert_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,30 @@
import pytest


def test_delete_alert_subscription(db, alert, alertsub, account_alert_queue):
def test_delete_alert_subscription(alert, alertsub, account_alert_queue):
alertsub.delete()
assert not AccountAlertQueue.objects.filter(pk=account_alert_queue.pk).exists()
assert not AlertQueue.objects.filter(pk=alert.pk).exists()


def test_sending_alert_to_alert_address_with_empty_address_will_raise_error(
alert_address, alert, alertsub
):
with pytest.raises(InvalidAlertAddressError):
alert_address.send(alert, alertsub)


def test_sending_alert_to_alert_address_with_invalid_address_will_raise_error(
db, alert_address, alert, alertsub
alert_address, alert, alertsub
):
alert_address.address = "abc"
alert_address.save()
with pytest.raises(InvalidAlertAddressError):
alert_address.send(alert, alertsub)


def test_sending_alert_to_alert_address_with_invalid_address_will_delete_alert_and_fail(
db, alert, account_alert_queue
alert, account_alert_queue
):
assert not account_alert_queue.send()
assert not AlertQueue.objects.filter(pk=alert.pk).exists()
Expand Down

0 comments on commit 7529721

Please sign in to comment.