def testUpdateWorkspaceSdkLatest(self): """Tests _UpdateWorkspaceSdk() with 'latest'.""" brillo_sdk._UpdateWorkspaceSdk( gs.GSContext(), self.bootstrap_path, self.workspace_path, 'latest') # Given the explicit path and version, sync what we expect, and where. expected = [mock.call(mock.ANY, os.path.join(self.tempdir, 'bootstrap/sdk_checkouts', self.latest_version), depth=1, repo_cmd=mock.ANY), mock.call().Sync()] self.assertEqual(expected, self.mock_repo.mock_calls)
def testUpdateWorkspaceSdk(self): """Tests _UpdateWorkspaceSdk() with a numeric version.""" brillo_sdk._UpdateWorkspaceSdk( gs.GSContext(), self.bootstrap_path, self.workspace_path, '1.2.3') # Given the explicit path and version, sync what we expect, and where. expected = [mock.call(mock.ANY, os.path.join(self.tempdir, 'bootstrap/sdk_checkouts/1.2.3'), depth=1, repo_cmd=mock.ANY), mock.call().Sync()] self.assertEqual(expected, self.mock_repo.mock_calls) # Update a second time, to ensure it does nothing the second time. brillo_sdk._UpdateWorkspaceSdk( gs.GSContext(), self.bootstrap_path, self.workspace_path, '1.2.3') self.assertEqual(expected, self.mock_repo.mock_calls)
def testUpdateWorkspaceSdkTot(self): """Tests _UpdateWorkspaceSdk() with 'tot'.""" brillo_sdk._UpdateWorkspaceSdk( gs.GSContext(), self.bootstrap_path, self.workspace_path, 'tot') # Given the explicit path and version, sync what we expect, and where. expected = [mock.call(constants.MANIFEST_URL, os.path.join(self.tempdir, 'bootstrap/sdk_checkouts/tot'), groups='project_sdk', repo_cmd=mock.ANY), mock.call().Sync()] self.assertEqual(expected, self.mock_repo.mock_calls) # Update a second time, to ensure it DOES update. brillo_sdk._UpdateWorkspaceSdk( gs.GSContext(), self.bootstrap_path, self.workspace_path, 'tot') self.assertEqual(2 * expected, self.mock_repo.mock_calls)