Skip to content

Commit

Permalink
Rename test class to reflect tested code
Browse files Browse the repository at this point in the history
  • Loading branch information
lucc committed Oct 9, 2023
1 parent 8a608e4 commit d39fe8d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/test_khard.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ def test_no_search_terms_result_in_any_queries(self):
self.assertEqual(expected, prepared["foo"])


class TestAddEmail(unittest.TestCase):
class TestFindEmailAddress(unittest.TestCase):

def test_find_email_addresses_empty_text_finds_none(self):
def test_empty_text_finds_none(self):
text = ""
addrs = find_email_addresses(text, ["from"])
self.assertEqual([], addrs)

def test_find_email_addresses_single_header_finds_one_address(self):
def test_single_header_finds_one_address(self):
text = """From: John Doe <jdoe@machine.example>"""
addrs = find_email_addresses(text, ["from"])
expected = [Address(display_name="John Doe",
username="jdoe", domain="machine.example")]
self.assertEqual(expected, addrs)

def test_find_email_addresses_single_header_finds_multiple_addresses(self):
def test_single_header_finds_multiple_addresses(self):
text = """From: John Doe <jdoe@machine.example>, \
Mary Smith <mary@example.net>"""
addrs = find_email_addresses(text, ["from"])
Expand All @@ -78,14 +78,14 @@ def test_find_email_addresses_single_header_finds_multiple_addresses(self):
domain="example.net")]
self.assertEqual(expected, addrs)

def test_find_email_addresses_non_address_header_finds_none(self):
def test_non_address_header_finds_none(self):
text = "From: John Doe <jdoe@machine.example>, " \
"Mary Smith <mary@example.net>\nOther: test"
addrs = find_email_addresses(text, ["other"])
expected = []
self.assertEqual(expected, addrs)

def test_find_email_addresses_multiple_headers_finds_some(self):
def test_multiple_headers_finds_some(self):
text = "From: John Doe <jdoe@machine.example>, " \
"Mary Smith <mary@example.net>\nOther: test"
addrs = find_email_addresses(text, ["other", "from"])
Expand All @@ -100,7 +100,7 @@ def test_find_email_addresses_multiple_headers_finds_some(self):
domain="example.net")]
self.assertEqual(expected, addrs)

def test_find_email_addresses_multiple_headers_finds_all(self):
def test_multiple_headers_finds_all(self):
text = "From: John Doe <jdoe@machine.example>, " \
"Mary Smith <mary@example.net>\n" \
"To: Michael Jones <mjones@machine.example>"
Expand All @@ -120,7 +120,7 @@ def test_find_email_addresses_multiple_headers_finds_all(self):
domain="example.net")]
self.assertEqual(expected, addrs)

def test_find_email_addresses_finds_all_emails(self):
def test_finds_all_emails(self):
text = "From: John Doe <jdoe@machine.example>, " \
"Mary Smith <mary@example.net>\n" \
"To: Michael Jones <mjones@machine.example>"
Expand All @@ -140,7 +140,7 @@ def test_find_email_addresses_finds_all_emails(self):
domain="machine.example")]
self.assertEqual(expected, addrs)

def test_find_email_addresses_finds_all_emails_with_other_headers_too(
def test_finds_all_emails_with_other_headers_too(
self):
text = "From: John Doe <jdoe@machine.example>, " \
"Mary Smith <mary@example.net>\n" \
Expand Down

0 comments on commit d39fe8d

Please sign in to comment.