diff options
Diffstat (limited to 'tests/test_git_superproject.py')
-rw-r--r-- | tests/test_git_superproject.py | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/tests/test_git_superproject.py b/tests/test_git_superproject.py index d2ee9f4f..07b9a7db 100644 --- a/tests/test_git_superproject.py +++ b/tests/test_git_superproject.py | |||
@@ -97,17 +97,17 @@ class SuperprojectTestCase(unittest.TestCase): | |||
97 | with mock.patch.object(self._superproject, '_GetBranch', return_value='junk'): | 97 | with mock.patch.object(self._superproject, '_GetBranch', return_value='junk'): |
98 | self.assertFalse(superproject.Sync()) | 98 | self.assertFalse(superproject.Sync()) |
99 | 99 | ||
100 | def test_superproject_get_superproject_mock_clone(self): | 100 | def test_superproject_get_superproject_mock_init(self): |
101 | """Test with _Clone failing.""" | 101 | """Test with _Init failing.""" |
102 | with mock.patch.object(self._superproject, '_Clone', return_value=False): | 102 | with mock.patch.object(self._superproject, '_Init', return_value=False): |
103 | self.assertFalse(self._superproject.Sync()) | 103 | self.assertFalse(self._superproject.Sync()) |
104 | 104 | ||
105 | def test_superproject_get_superproject_mock_fetch(self): | 105 | def test_superproject_get_superproject_mock_fetch(self): |
106 | """Test with _Fetch failing and _clone being called.""" | 106 | """Test with _Fetch failing.""" |
107 | with mock.patch.object(self._superproject, '_Clone', return_value=True): | 107 | with mock.patch.object(self._superproject, '_Init', return_value=True): |
108 | os.mkdir(self._superproject._superproject_path) | 108 | os.mkdir(self._superproject._superproject_path) |
109 | with mock.patch.object(self._superproject, '_Fetch', return_value=False): | 109 | with mock.patch.object(self._superproject, '_Fetch', return_value=False): |
110 | self.assertTrue(self._superproject.Sync()) | 110 | self.assertFalse(self._superproject.Sync()) |
111 | 111 | ||
112 | def test_superproject_get_all_project_commit_ids_mock_ls_tree(self): | 112 | def test_superproject_get_all_project_commit_ids_mock_ls_tree(self): |
113 | """Test with LsTree being a mock.""" | 113 | """Test with LsTree being a mock.""" |
@@ -116,14 +116,15 @@ class SuperprojectTestCase(unittest.TestCase): | |||
116 | '160000 commit e9d25da64d8d365dbba7c8ee00fe8c4473fe9a06\tbootable/recovery\x00' | 116 | '160000 commit e9d25da64d8d365dbba7c8ee00fe8c4473fe9a06\tbootable/recovery\x00' |
117 | '120000 blob acc2cbdf438f9d2141f0ae424cec1d8fc4b5d97f\tbootstrap.bash\x00' | 117 | '120000 blob acc2cbdf438f9d2141f0ae424cec1d8fc4b5d97f\tbootstrap.bash\x00' |
118 | '160000 commit ade9b7a0d874e25fff4bf2552488825c6f111928\tbuild/bazel\x00') | 118 | '160000 commit ade9b7a0d874e25fff4bf2552488825c6f111928\tbuild/bazel\x00') |
119 | with mock.patch.object(self._superproject, '_Clone', return_value=True): | 119 | with mock.patch.object(self._superproject, '_Init', return_value=True): |
120 | with mock.patch.object(self._superproject, '_LsTree', return_value=data): | 120 | with mock.patch.object(self._superproject, '_Fetch', return_value=True): |
121 | commit_ids = self._superproject._GetAllProjectsCommitIds() | 121 | with mock.patch.object(self._superproject, '_LsTree', return_value=data): |
122 | self.assertEqual(commit_ids, { | 122 | commit_ids = self._superproject._GetAllProjectsCommitIds() |
123 | 'art': '2c2724cb36cd5a9cec6c852c681efc3b7c6b86ea', | 123 | self.assertEqual(commit_ids, { |
124 | 'bootable/recovery': 'e9d25da64d8d365dbba7c8ee00fe8c4473fe9a06', | 124 | 'art': '2c2724cb36cd5a9cec6c852c681efc3b7c6b86ea', |
125 | 'build/bazel': 'ade9b7a0d874e25fff4bf2552488825c6f111928' | 125 | 'bootable/recovery': 'e9d25da64d8d365dbba7c8ee00fe8c4473fe9a06', |
126 | }) | 126 | 'build/bazel': 'ade9b7a0d874e25fff4bf2552488825c6f111928' |
127 | }) | ||
127 | 128 | ||
128 | def test_superproject_write_manifest_file(self): | 129 | def test_superproject_write_manifest_file(self): |
129 | """Test with writing manifest to a file after setting revisionId.""" | 130 | """Test with writing manifest to a file after setting revisionId.""" |
@@ -151,7 +152,7 @@ class SuperprojectTestCase(unittest.TestCase): | |||
151 | projects = self._superproject._manifest.projects | 152 | projects = self._superproject._manifest.projects |
152 | data = ('160000 commit 2c2724cb36cd5a9cec6c852c681efc3b7c6b86ea\tart\x00' | 153 | data = ('160000 commit 2c2724cb36cd5a9cec6c852c681efc3b7c6b86ea\tart\x00' |
153 | '160000 commit e9d25da64d8d365dbba7c8ee00fe8c4473fe9a06\tbootable/recovery\x00') | 154 | '160000 commit e9d25da64d8d365dbba7c8ee00fe8c4473fe9a06\tbootable/recovery\x00') |
154 | with mock.patch.object(self._superproject, '_Clone', return_value=True): | 155 | with mock.patch.object(self._superproject, '_Init', return_value=True): |
155 | with mock.patch.object(self._superproject, '_Fetch', return_value=True): | 156 | with mock.patch.object(self._superproject, '_Fetch', return_value=True): |
156 | with mock.patch.object(self._superproject, | 157 | with mock.patch.object(self._superproject, |
157 | '_LsTree', | 158 | '_LsTree', |