Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/pypi/tests/test_converters.py
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | def test_author_basic(self): | ||||
expected_author = { | expected_author = { | ||||
'fullname': b'i-am-groot <iam@groot.org>', | 'fullname': b'i-am-groot <iam@groot.org>', | ||||
'name': b'i-am-groot', | 'name': b'i-am-groot', | ||||
'email': b'iam@groot.org', | 'email': b'iam@groot.org', | ||||
} | } | ||||
self.assertEqual(actual_author, expected_author) | self.assertEqual(actual_author, expected_author) | ||||
def test_author_empty_email(self): | |||||
data = { | |||||
'author': 'i-am-groot', | |||||
'author_email': '', | |||||
} | |||||
actual_author = author(data) | |||||
expected_author = { | |||||
'fullname': b'i-am-groot', | |||||
'name': b'i-am-groot', | |||||
'email': b'', | |||||
} | |||||
self.assertEqual(actual_author, expected_author) | |||||
def test_author_empty_name(self): | |||||
data = { | |||||
'author': "", | |||||
'author_email': 'iam@groot.org', | |||||
} | |||||
actual_author = author(data) | |||||
expected_author = { | |||||
'fullname': b' <iam@groot.org>', | |||||
'name': b'', | |||||
'email': b'iam@groot.org', | |||||
} | |||||
self.assertEqual(actual_author, expected_author) | |||||
def test_author_malformed(self): | def test_author_malformed(self): | ||||
data = { | data = { | ||||
'author': "['pierre', 'paul', 'jacques']", | 'author': "['pierre', 'paul', 'jacques']", | ||||
'author_email': None, | 'author_email': None, | ||||
} | } | ||||
actual_author = author(data) | actual_author = author(data) | ||||
Show All 39 Lines |