def test_credentials_are_generated_from_saml(self, mock_sts): stub_token = Struct({'credentials': None}) mock_conn = MagicMock() mock_conn.assume_role_with_saml.return_value = stub_token mock_sts.connect_to_region.return_value = mock_conn assertion = saml_assertion(['arn:aws:iam::1111:role/DevRole,arn:aws:iam::1111:saml-provider/IDP']) token = Actions.saml_token('un-south-1', assertion) self.assertEqual(token, stub_token)
def test_credentials_are_generated_from_saml(self, mock_sts): stub_token = Struct({'credentials': None}) mock_conn = MagicMock() mock_conn.assume_role_with_saml.return_value = stub_token mock_sts.connect_to_region.return_value = mock_conn assertion = saml_assertion([ 'arn:aws:iam::1111:role/DevRole,arn:aws:iam::1111:saml-provider/IDP' ]) token = Actions.saml_token('un-south-1', assertion) self.assertEqual(token, stub_token)
def saml_action(args): args['assertion'] = read_stdin() token_action(args)(Actions.saml_token(**args))