Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import pytest
from augur.tasks.git.util.facade_worker.facade_worker.analyzecommit import check_swapped_emails

def test_correct_input_unchanged():
name, email = check_swapped_emails("John Smith", "[email protected]")
assert name == "John Smith"
assert email == "[email protected]"

def test_swapped_input_is_corrected():
name, email = check_swapped_emails("[email protected]", "John Smith")
assert name == "John Smith"
assert email == "[email protected]"

def test_name_field_contains_mixed_name_and_email():
# name field has both a name and email mixed together
name, email = check_swapped_emails("John Smith [email protected]", "")
assert name == "John Smith [email protected]"
assert email == ""

def test_email_field_contains_mixed_name_and_email():
# email field has both a name and email mixed together
name, email = check_swapped_emails("John Smith", "John Smith [email protected]")
assert name == "John Smith"
assert email == "John Smith [email protected]"

def test_both_fields_contain_mixed_name_and_email():
name, email = check_swapped_emails("John Smith [email protected]", "Jane Doe [email protected]")
assert name == "John Smith [email protected]"
assert email == "Jane Doe [email protected]"

def test_when_both_empty_strings():
name, email = check_swapped_emails("", "")
assert name == ""
assert email == ""

def test_email_with_multiple_at_signs():
name, email = check_swapped_emails("John Smith", "john@@gmail.com")
assert name == "John Smith"
assert email == "john@@gmail.com"