fixing up base64 encoding for python 3 back to using base64 module
This commit is contained in:
parent
73a4c83c1a
commit
abae19d273
@ -4,7 +4,7 @@ from boto.exception import BotoServerError
|
||||
from moto.core import BaseBackend
|
||||
from .utils import random_access_key, random_alphanumeric, random_resource_id
|
||||
from datetime import datetime
|
||||
import codecs
|
||||
import base64
|
||||
|
||||
class Role(object):
|
||||
|
||||
@ -446,6 +446,6 @@ class IAMBackend(BaseBackend):
|
||||
report = 'user,arn,user_creation_time,password_enabled,password_last_used,password_last_changed,password_next_rotation,mfa_active,access_key_1_active,access_key_1_last_rotated,access_key_2_active,access_key_2_last_rotated,cert_1_active,cert_1_last_rotated,cert_2_active,cert_2_last_rotated\n'
|
||||
for user in self.users:
|
||||
report += self.users[user].to_csv()
|
||||
return codecs.encode(report.encode('ascii'), 'base64').decode('ascii')
|
||||
return base64.b64encode(report.encode('ascii')).decode('ascii')
|
||||
|
||||
iam_backend = IAMBackend()
|
||||
|
@ -5,7 +5,7 @@ import re
|
||||
|
||||
from nose.tools import assert_raises, assert_equals, assert_not_equals
|
||||
from boto.exception import BotoServerError
|
||||
import codecs
|
||||
import base64
|
||||
from moto import mock_iam
|
||||
|
||||
|
||||
@ -220,5 +220,5 @@ def test_get_credential_report():
|
||||
while result['generate_credential_report_response']['generate_credential_report_result']['state'] != 'COMPLETE':
|
||||
result = conn.generate_credential_report()
|
||||
result = conn.get_credential_report()
|
||||
report = codecs.decode(result['get_credential_report_response']['get_credential_report_result']['content'].encode('ascii'), 'base64').decode('ascii')
|
||||
report = base64.b64decode(result['get_credential_report_response']['get_credential_report_result']['content'].encode('ascii')).decode('ascii')
|
||||
report.should.match(r'.*my-user.*')
|
Loading…
Reference in New Issue
Block a user