def test_build_query_string(self): auth = STSAnonHandler('sts.amazonaws.com', Mock(), self.provider) query_string = auth._build_query_string(self.request.params) self.assertEqual(query_string, 'Action=AssumeRoleWithWebIdentity' + \ '&ProviderId=2012-06-01&RoleSessionName=web-identity-federation' + \ '&Version=2011-06-15&WebIdentityToken=Atza%7CIQEBLjAsAhRkcxQ')
def test_escape_value(self): auth = STSAnonHandler('sts.amazonaws.com', Mock(), self.provider) # This is changed from a previous version because this string is # being passed to the query string and query strings must # be url encoded. value = auth._escape_value('Atza|IQEBLjAsAhRkcxQ') self.assertEqual(value, 'Atza%7CIQEBLjAsAhRkcxQ')
def test_add_auth(self): auth = STSAnonHandler('sts.amazonaws.com', Mock(), self.provider) req = copy.copy(self.request) auth.add_auth(req) self.assertEqual(req.body, 'Action=AssumeRoleWithWebIdentity' + \ '&ProviderId=2012-06-01&RoleSessionName=web-identity-federation' + \ '&Version=2011-06-15&WebIdentityToken=Atza%7CIQEBLjAsAhRkcxQ')