Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/base/tests/test_build_revision.py
- This file was added.
# Copyright (C) 2015-2018 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 | |||||
import unittest | |||||
from unittest.mock import patch | |||||
from swh.loader.base import build_revision as build | |||||
# Under construction | |||||
class TestBuild_Revision(unittest.TestCase): | |||||
@patch('swh.loader.base.build_revision.directory') | |||||
def test_compute_revision(self, mock_directory): | |||||
package_source_data = {} | |||||
mock_directory.return_value = 'some-other-time' | |||||
actual_revision = build.compute_revision('/some/path', | |||||
package_source_data) | |||||
# make me | |||||
expected_revision = { | |||||
'date': { | |||||
'timestamp': 'some-other-time', | |||||
'offset': build.UTC_OFFSET, | |||||
}, | |||||
'committer_date': { | |||||
'timestamp': 'some-other-time', | |||||
'offset': build.UTC_OFFSET, | |||||
}, | |||||
'author': build.SWH_PERSON, | |||||
'committer': build.SWH_PERSON, | |||||
'type': build.REVISION_TYPE, | |||||
'message': build.REVISION_MESSAGE, | |||||
'synthetic': True, | |||||
} | |||||
# then | |||||
self.assertEqual(actual_revision, expected_revision) | |||||
mock_directory.assert_called_once_with('/some/path') |