def test_list_packages(self, mock_get): host = _DEFAULT_HOST client = RegistryClient(host=host, auth=ApiAuth('')) client.list_packages() mock_get.assert_called_once_with( url=('https://artifactregistry.googleapis.com/v1/projects/' 'proj/locations/us-central1/repositories' '/repo/packages'), data='', headers=None, auth=mock.ANY)
def test_list_packages_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('')) packages = client.list_packages() self.assertEqual(packages, {}) mock_get.assert_called_once_with( url=('https://artifactregistry.googleapis.com/v1/projects/' 'proj/locations/us-central1/repositories' '/repo/packages'), data='', headers=None, auth=mock.ANY)