def test_get_projects(self): storage.get_latest_async.return_value.set_result(''' projects { id: "chromium" config_location { storage_type: GITILES url: "http://localhost" } } ''') expected = service_config_pb2.ProjectsCfg(projects=[ service_config_pb2.Project( id='chromium', config_location=service_config_pb2.ConfigSetLocation( storage_type=service_config_pb2.ConfigSetLocation.GITILES, url='http://localhost')), ], ) self.assertEqual(projects.get_projects(), expected.projects)
def test_get_projects(self): self.mock_latest_config( storage.get_self_config_set(), ''' projects { id: "chromium" gitiles_location { repo: "https://localhost" ref: "refs/heads/main" } } ''') expected = service_config_pb2.ProjectsCfg(projects=[ service_config_pb2.Project( id='chromium', gitiles_location=service_config_pb2.GitilesLocation( repo='https://localhost', ref='refs/heads/main', ), ), ], ) self.assertEqual(projects.get_projects(), expected.projects)