diff --git a/swh/loader/svn/converters.py b/swh/loader/svn/converters.py --- a/swh/loader/svn/converters.py +++ b/swh/loader/svn/converters.py @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2018 The Software Heritage developers +# Copyright (C) 2015-2020 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information @@ -8,27 +8,6 @@ from .utils import strdate_to_timestamp -def svn_date_to_gitsvn_date(strdate): - """Convert a string date to an swh one. - - Args: - strdate: A string formatted for .utils.strdate_to_timestamp - to do its jobs - - Returns: - An swh date format with an integer timestamp. - - """ - ts = strdate_to_timestamp(strdate) - return { - 'timestamp': { - 'seconds': ts['seconds'], - 'microseconds': 0, - }, - 'offset': 0 - } - - def svn_date_to_swh_date(strdate): """Convert a string date to an swh one. diff --git a/swh/loader/svn/tests/test_converters.py b/swh/loader/svn/tests/test_converters.py --- a/swh/loader/svn/tests/test_converters.py +++ b/swh/loader/svn/tests/test_converters.py @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2018 The Software Heritage developers +# Copyright (C) 2015-2020 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information @@ -8,47 +8,6 @@ from swh.loader.svn import converters -class TestAuthorGitSvnConverters(unittest.TestCase): - def test_svn_author_to_gitsvn_person(self): - """The author should have name, email and fullname filled. - - """ - actual_person = converters.svn_author_to_gitsvn_person( - 'tony ', - repo_uuid=None) - self.assertEqual(actual_person, { - 'fullname': b'tony ', - 'name': b'tony', - 'email': b'ynot@dagobah', - }) - - def test_svn_author_to_gitsvn_person_no_email(self): - """The author should see his/her email filled with author@. - - """ - actual_person = converters.svn_author_to_gitsvn_person( - 'tony', - repo_uuid=b'some-uuid') - self.assertEqual(actual_person, { - 'fullname': b'tony ', - 'name': b'tony', - 'email': b'tony@some-uuid', - }) - - def test_svn_author_to_gitsvn_person_empty_person(self): - """The empty person should see name, fullname and email filled. - - """ - actual_person = converters.svn_author_to_gitsvn_person( - '', - repo_uuid=b'some-uuid') - self.assertEqual(actual_person, { - 'fullname': b'(no author) <(no author)@some-uuid>', - 'name': b'(no author)', - 'email': b'(no author)@some-uuid' - }) - - class TestAuthorConverters(unittest.TestCase): def test_svn_author_to_swh_person(self): """The author should have name, email and fullname filled. @@ -245,36 +204,3 @@ 'microseconds': 0, }, 'offset': 0, }, converters.svn_date_to_swh_date(None)) - - -class ConvertGitSvnDate(unittest.TestCase): - def test_svn_date_to_gitsvn_date(self): - """The timestamp should be truncated to be an integer.""" - actual_ts = converters.svn_date_to_gitsvn_date( - '2011-05-31T06:04:39.800722Z') - - self.assertEqual(actual_ts, { - 'timestamp': { - 'seconds': 1306821879, - 'microseconds': 0, - }, - 'offset': 0, - }) - - def test_svn_date_to_gitsvn_date_epoch(self): - """Empty date should be EPOCH (timestamp and offset at 0).""" - # It should return 0, epoch - self.assertEqual({ - 'timestamp': { - 'seconds': 0, - 'microseconds': 0, - }, - 'offset': 0, - }, converters.svn_date_to_gitsvn_date('')) - self.assertEqual({ - 'timestamp': { - 'seconds': 0, - 'microseconds': 0, - }, - 'offset': 0, - }, converters.svn_date_to_gitsvn_date(None))