예제 #1
0
 def test_list_tags(self, mock_get):
     host = _DEFAULT_HOST
     client = RegistryClient(host=host, auth=ApiAuth(''))
     client.list_tags('pack')
     mock_get.assert_called_once_with(
         url=('https://artifactregistry.googleapis.com/v1/projects/'
              'proj/locations/us-central1/repositories'
              '/repo/packages/pack/tags'),
         data='',
         headers=None,
         auth=mock.ANY)
예제 #2
0
 def test_list_tags_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(''))
     tags = client.list_tags('pack')
     self.assertEqual(tags, {})
     mock_get.assert_called_once_with(
         url=('https://artifactregistry.googleapis.com/v1/projects/'
              'proj/locations/us-central1/repositories'
              '/repo/packages/pack/tags'),
         data='',
         headers=None,
         auth=mock.ANY)