-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cb1bfe
commit 57934f4
Showing
4 changed files
with
61 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,21 @@ def test_clean_record_with_valid_input(): | |
"email_error": "", | ||
"phone": "(626) 420-6969", | ||
"phone_is_invalid": False, | ||
"phone_is_intl": False, | ||
} | ||
|
||
|
||
def test_clean_record_with_valid_intl_number(): | ||
response = client.get( | ||
f"/clean-record?apikey={APIKEY}&phone=%2b443476669193&[email protected]" | ||
) | ||
assert response.status_code == 200 | ||
assert response.json() == { | ||
"email": "[email protected]", | ||
"email_error": "", | ||
"phone": "+44 347 666 9193", | ||
"phone_is_invalid": False, | ||
"phone_is_intl": True, | ||
} | ||
|
||
|
||
|
@@ -32,6 +47,7 @@ def test_clean_record_with_null_input(): | |
"phone": "", | ||
"email_error": "No email address provided", | ||
"phone_is_invalid": True, | ||
"phone_is_intl": False, | ||
} | ||
|
||
|
||
|
@@ -43,6 +59,7 @@ def test_clean_record_with_missing_input(): | |
"phone": "", | ||
"email_error": "No email address provided", | ||
"phone_is_invalid": True, | ||
"phone_is_intl": False, | ||
} | ||
|
||
|
||
|
@@ -56,6 +73,7 @@ def test_clean_record_with_invalid_email(): | |
"phone": "", | ||
"email_error": "The email address is not valid. It must have exactly one @-sign.", | ||
"phone_is_invalid": True, | ||
"phone_is_intl": False, | ||
} | ||
|
||
|
||
|
@@ -64,24 +82,10 @@ def test_clean_record_with_reformatted_email(): | |
f"/clean-record?apikey={APIKEY}&phone=&email=foo @gmail .com" | ||
) | ||
assert response.status_code == 200 | ||
print(response.json()) | ||
assert response.json() == { | ||
"email": "[email protected]", | ||
"phone": "", | ||
"email_error": "", | ||
"phone_is_invalid": True, | ||
} | ||
|
||
|
||
def test_clean_record_with_reformatted_email(): | ||
response = client.get( | ||
f"/clean-record?apikey={APIKEY}&phone=&email=foo @gmail .com" | ||
) | ||
assert response.status_code == 200 | ||
print(response.json()) | ||
assert response.json() == { | ||
"email": "[email protected]", | ||
"phone": "", | ||
"email_error": "", | ||
"phone_is_invalid": True, | ||
"phone_is_intl": False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters