Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/svn/tests/test_converters.py
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | def svn_author_to_gitsvn_person_empty_person(self): | ||||
repo_uuid=b'some-uuid') | repo_uuid=b'some-uuid') | ||||
self.assertEqual(actual_person, { | self.assertEqual(actual_person, { | ||||
'fullname': b'(no author) <(no author)@some-uuid>', | 'fullname': b'(no author) <(no author)@some-uuid>', | ||||
'name': b'(no author)', | 'name': b'(no author)', | ||||
'email': b'(no author)@some-uuid' | 'email': b'(no author)@some-uuid' | ||||
}) | }) | ||||
class TestAuthorSWHConverters(unittest.TestCase): | class TestAuthorConverters(unittest.TestCase): | ||||
@istest | @istest | ||||
def svn_author_to_swh_person(self): | def svn_author_to_swh_person(self): | ||||
"""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>') | 'tony <ynot@dagobah>') | ||||
self.assertEquals(actual_person, { | self.assertEquals(actual_person, { | ||||
Show All 23 Lines | def svn_author_to_swh_person_empty_person(self): | ||||
actual_person = converters.svn_author_to_swh_person('') | actual_person = converters.svn_author_to_swh_person('') | ||||
self.assertEqual(actual_person, { | self.assertEqual(actual_person, { | ||||
'fullname': b'', | 'fullname': b'', | ||||
'name': None, | 'name': None, | ||||
'email': None, | 'email': None, | ||||
}) | }) | ||||
class TestSWHRevisionConverters(unittest.TestCase): | class TestRevisionConverters(unittest.TestCase): | ||||
@istest | @istest | ||||
def build_swh_revision_default(self): | def build_swh_revision_default(self): | ||||
"""This should build the swh revision with the swh revision's extra | """This should build the swh revision with the swh revision's extra | ||||
headers about the repository. | headers about the repository. | ||||
""" | """ | ||||
actual_swh_revision = converters.build_swh_revision( | actual_swh_revision = converters.build_swh_revision( | ||||
repo_uuid=b'uuid', | repo_uuid=b'uuid', | ||||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | def build_gitsvn_swh_revision_default(self): | ||||
'fullname': b'theo <theo@uuid>' | 'fullname': b'theo <theo@uuid>' | ||||
}, | }, | ||||
'synthetic': True, | 'synthetic': True, | ||||
'metadata': None, | 'metadata': None, | ||||
'parents': ['123'], | 'parents': ['123'], | ||||
}) | }) | ||||
class ConvertSWHDate(unittest.TestCase): | class ConvertDate(unittest.TestCase): | ||||
@istest | @istest | ||||
def svn_date_to_swh_date(self): | def svn_date_to_swh_date(self): | ||||
"""The timestamp should not be tampered with and include the | """The timestamp should not be tampered with and include the | ||||
decimals. | decimals. | ||||
""" | """ | ||||
self.assertEquals( | self.assertEquals( | ||||
converters.svn_date_to_swh_date('2011-05-31T06:04:39.500900Z'), { | converters.svn_date_to_swh_date('2011-05-31T06:04:39.500900Z'), { | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |