def test_list_versions(self, mock_get): host = _DEFAULT_HOST client = RegistryClient(host=host, auth=ApiAuth('')) client.list_versions('pack') mock_get.assert_called_once_with( url=('https://artifactregistry.googleapis.com/v1/projects/' 'proj/locations/us-central1/repositories' '/repo/packages/pack/versions'), data='', headers=None, auth=mock.ANY)
def test_list_versions_empty(self, mock_get): host = _DEFAULT_HOST mock_response = requests.Response() mock_response.status_code = 200 mock_response._content = json.dumps({}).encode('utf-8') mock_get.return_value = mock_response client = RegistryClient(host=host, auth=ApiAuth('')) versions = client.list_versions('pack') self.assertEqual(versions, {}) mock_get.assert_called_once_with( url=('https://artifactregistry.googleapis.com/v1/projects/' 'proj/locations/us-central1/repositories' '/repo/packages/pack/versions'), data='', headers=None, auth=mock.ANY)