1#!/usr/bin/env python3
2
3"""Test the email_delivery decorator
4"""
5import unittest
6import json
7
8import django
9django.setup()
10
11from chart.web.userinfo import validate_email_address
12
13
14INVALID_EMAIL_ADDRESS_MESSAGE = 'Non-EUMETSAT addresses are not allowed'
15
16class TestEmailValidity(unittest.TestCase):
17 """Unit tests for userinfo.py"""
18
19 def test_invalid_email_addr(self):
20 email_address = 'user@domain.int'
21 validated_email_addr = validate_email_address(email_address)
22 self.assertEqual(validated_email_addr, INVALID_EMAIL_ADDRESS_MESSAGE)
23
24 def test_internal_email_addr(self):
25 email_address = 'user@eumetsat.int'
26 validated_email_addr = validate_email_address(email_address)
27 self.assertEqual(validated_email_addr, True)
28
29 def test_external_email_addr(self):
30 email_address = 'user@external.eumetsat.int'
31 validated_email_addr = validate_email_address(email_address)
32 self.assertEqual(validated_email_addr, True)