Skip to content

Commit

Permalink
test: Remove incomplete unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
setu4993 committed Aug 22, 2024
1 parent dd05548 commit 3a5cd22
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions tests/unit/credentials_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import os
import unittest.mock as mock
from datetime import datetime, timedelta
from unittest import TestCase

from minio.credentials.credentials import Credentials
from minio.credentials.providers import (AWSConfigProvider, ChainedProvider,
EnvAWSProvider, EnvMinioProvider,
IamAwsProvider,
MinioClientConfigProvider,
StaticProvider)

Expand All @@ -45,43 +40,6 @@ def test_credentials_get(self):
self.assertEqual(creds.session_token, None)


class TokenResponse(object):
status = 200
data = b"test-s3-token-for-minio"


class CredListResponse(object):
status = 200
data = b"test-s3-full-access-for-minio-ec2"


class CredsResponse(object):
status = 200
data = json.dumps({
"Code": "Success",
"Type": "AWS-HMAC",
"AccessKeyId": "accessKey",
"SecretAccessKey": "secret",
"Token": "token",
"Expiration": "2014-12-16T01:51:37Z",
"LastUpdated": "2009-11-23T0:00:00Z"
})


class IamAwsProviderTest(TestCase):
@mock.patch("urllib3.PoolManager.urlopen")
def test_iam(self, mock_connection):
mock_connection.side_effect = [
TokenResponse(), CredListResponse(), CredsResponse()
]
provider = IamAwsProvider()
creds = provider.retrieve()
self.assertEqual(creds.access_key, "accessKey")
self.assertEqual(creds.secret_key, "secret")
self.assertEqual(creds.session_token, "token")
self.assertEqual(creds._expiration, datetime(2014, 12, 16, 1, 51, 37))


class ChainedProviderTest(TestCase):
def test_chain_retrieve(self):
# clear environment
Expand Down

0 comments on commit 3a5cd22

Please sign in to comment.