Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/svn/tests/test_converters.py
Show All 9 Lines | |||||
from swh.loader.svn import converters | from swh.loader.svn import converters | ||||
def test_svn_author_to_swh_person(): | def test_svn_author_to_swh_person(): | ||||
"""The author should have name, email and fullname filled. | """The author should have name, email and fullname filled. | ||||
""" | """ | ||||
actual_person = converters.svn_author_to_swh_person( | actual_person = converters.svn_author_to_swh_person( | ||||
'tony <ynot@dagobah>') | b'tony <ynot@dagobah>') | ||||
assert actual_person == Person.from_dict({ | assert actual_person == Person.from_dict({ | ||||
'fullname': b'tony <ynot@dagobah>', | 'fullname': b'tony <ynot@dagobah>', | ||||
'name': b'tony', | 'name': b'tony', | ||||
'email': b'ynot@dagobah', | 'email': b'ynot@dagobah', | ||||
}) | }) | ||||
def test_svn_author_to_swh_person_no_email(): | def test_svn_author_to_swh_person_no_email(): | ||||
"""The author and fullname should be the same as the input (author). | """The author and fullname should be the same as the input (author). | ||||
""" | """ | ||||
actual_person = converters.svn_author_to_swh_person('tony') | actual_person = converters.svn_author_to_swh_person(b'tony') | ||||
assert actual_person == Person.from_dict({ | assert actual_person == Person.from_dict({ | ||||
'fullname': b'tony', | 'fullname': b'tony', | ||||
'name': b'tony', | 'name': b'tony', | ||||
'email': None, | 'email': None, | ||||
}) | }) | ||||
def test_svn_author_to_swh_person_empty_person(): | def test_svn_author_to_swh_person_empty_person(): | ||||
"""Empty person has only its fullname filled with the empty | """Empty person has only its fullname filled with the empty | ||||
byte-string. | byte-string. | ||||
""" | """ | ||||
actual_person = converters.svn_author_to_swh_person('') | actual_person = converters.svn_author_to_swh_person(b'') | ||||
assert actual_person == Person.from_dict({ | assert actual_person == Person.from_dict({ | ||||
'fullname': b'', | 'fullname': b'', | ||||
'name': None, | 'name': None, | ||||
'email': None, | 'email': None, | ||||
}) | }) | ||||
def test_build_swh_revision_default(): | def test_build_swh_revision_default(): | ||||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |