Beispiel #1
0
 def testUntag_TokenRefresh403(self):
     expected_message = 'Bad status during token exchange: 403'
     exception = docker_http.TokenRefreshException(expected_message)
     self.mock_delete.side_effect = exception
     with self.assertRaises(util.TokenRefreshError) as cm:
         self.Untag([_TAG_V1])
     self.assertIn(expected_message, six.text_type(cm.exception))
Beispiel #2
0
 def testDescribe_TokenRefreshFailure(self, mock_get_digest_from_name):
   expected_message = 'Bad status during token exchange: 403'
   exception = docker_http.TokenRefreshException(expected_message)
   mock_get_digest_from_name.side_effect = exception
   test_image = 'gcr.io/foo/goodimage:latest'
   with self.assertRaises(util.TokenRefreshError):
     self.Describe(test_image)
   self.AssertErrContains(expected_message)
Beispiel #3
0
  def testListTokenRefreshError(self):
    expected_message = 'Bad status during token exchange: 403'
    exception = docker_http.TokenRefreshException(expected_message)

    self.registry_mock.children.side_effect = exception

    with self.assertRaises(util.TokenRefreshError):
      self.List()
    self.AssertErrContains(expected_message)
Beispiel #4
0
 def testBadStateException_CredentialRefreshError(self, track):
   transform_manifests_mock = self.StartPatch(
       'googlecloudsdk.api_lib.container.images.util.TransformManifests')
   expected_message = 'Bad status during token exchange: 403'
   exception = docker_http.TokenRefreshException(expected_message)
   transform_manifests_mock.side_effect = exception
   with self.assertRaises(util.TokenRefreshError) as cm:
     self.ListTags(track)
   self.assertIn(expected_message, six.text_type(cm.exception))
Beispiel #5
0
    def testDeleteDigest_TokenRefreshError(self):
        self._manifests = {_DIGEST_SUFFIX1: {'tag': _TAGS1, 'timestamp': ''}}

        expected_message = 'Bad status during token exchange: 403'
        exception = docker_http.TokenRefreshException(expected_message)

        self.digest_from_name_mock.side_effect = exception

        with self.assertRaises(util.TokenRefreshError):
            self.Delete([_TAG_V1])