diff options
author | David Bradford <david.bradford@mongodb.com> | 2021-04-21 17:32:53 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-04-23 17:16:03 +0000 |
commit | 1b9f63cdaf59922feec3b2c6d2c9017fefd595f1 (patch) | |
tree | ce60f70d8b1d49ef1371aacf165b0af80981d122 /buildscripts/tests/patch_builds | |
parent | 1852f29b020ac45ca6a43f6d7c9ecd2d3333be54 (diff) | |
download | mongo-1b9f63cdaf59922feec3b2c6d2c9017fefd595f1.tar.gz |
SERVER-50595: Don't require evergreen.py for local lint runs
Diffstat (limited to 'buildscripts/tests/patch_builds')
-rw-r--r-- | buildscripts/tests/patch_builds/test_change_data.py | 17 | ||||
-rw-r--r-- | buildscripts/tests/patch_builds/test_evg_change_data.py | 32 |
2 files changed, 32 insertions, 17 deletions
diff --git a/buildscripts/tests/patch_builds/test_change_data.py b/buildscripts/tests/patch_builds/test_change_data.py index 531dea65569..88eb2522224 100644 --- a/buildscripts/tests/patch_builds/test_change_data.py +++ b/buildscripts/tests/patch_builds/test_change_data.py @@ -72,20 +72,3 @@ class TestGenerateRevisionMap(unittest.TestCase): self.assertEqual(revision_map[mock_repo_list[0].git_dir], revision_data["mongo"]) self.assertEqual(len(revision_map), 1) - - -class TestGenerateRevisionMapFromManifest(unittest.TestCase): - def test_map_can_be_created_from_evergreen_api(self): - mock_repo_list = [create_mock_repo(os.getcwd()), create_mock_repo("/path/to/enterprise")] - mongo_revision = "revision1234" - enterprise_revision = "revision5678" - mock_manifest = MagicMock(revision=mongo_revision, - modules={"enterprise": MagicMock(revision=enterprise_revision)}) - mock_evg_api = MagicMock() - mock_evg_api.manifest_for_task.return_value = mock_manifest - - revision_map = under_test.generate_revision_map_from_manifest(mock_repo_list, "task_id", - mock_evg_api) - - self.assertEqual(revision_map[mock_repo_list[0].git_dir], mongo_revision) - self.assertEqual(revision_map[mock_repo_list[1].git_dir], enterprise_revision) diff --git a/buildscripts/tests/patch_builds/test_evg_change_data.py b/buildscripts/tests/patch_builds/test_evg_change_data.py new file mode 100644 index 00000000000..c7ddcf9d1a3 --- /dev/null +++ b/buildscripts/tests/patch_builds/test_evg_change_data.py @@ -0,0 +1,32 @@ +"""Unit tests for buildscripts.patch_builds.evg_change_data.py.""" +from __future__ import absolute_import + +import os +import unittest + +from mock import MagicMock + +import buildscripts.patch_builds.evg_change_data as under_test + +# pylint: disable=missing-docstring + + +def create_mock_repo(working_dir=""): + return MagicMock(working_dir=working_dir) + + +class TestGenerateRevisionMapFromManifest(unittest.TestCase): + def test_map_can_be_created_from_evergreen_api(self): + mock_repo_list = [create_mock_repo(os.getcwd()), create_mock_repo("/path/to/enterprise")] + mongo_revision = "revision1234" + enterprise_revision = "revision5678" + mock_manifest = MagicMock(revision=mongo_revision, + modules={"enterprise": MagicMock(revision=enterprise_revision)}) + mock_evg_api = MagicMock() + mock_evg_api.manifest_for_task.return_value = mock_manifest + + revision_map = under_test.generate_revision_map_from_manifest(mock_repo_list, "task_id", + mock_evg_api) + + self.assertEqual(revision_map[mock_repo_list[0].git_dir], mongo_revision) + self.assertEqual(revision_map[mock_repo_list[1].git_dir], enterprise_revision) |