@@ -0,0 +1,3046 @@
+# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A#      http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0A# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the%0A# License for the specific language governing permissions and limitations%0A# under the License.%0A%0Aimport uuid%0A%0Aimport httpretty%0A%0Afrom keystoneclient.tests.v3 import utils%0Afrom keystoneclient.v3.contrib.federation import identity_providers%0A%0A%0Aclass IdentityProviderTests(utils.TestCase, utils.CrudTests):%0A    def setUp(self):%0A        super(IdentityProviderTests, self).setUp()%0A        self.key = 'identity_provider'%0A        self.collection_key = 'identity_providers'%0A        self.model = identity_providers.IdentityProvider%0A        self.manager = self.client.federation.identity_providers%0A        self.path_prefix = 'OS-FEDERATION'%0A%0A    def new_ref(self, **kwargs):%0A        kwargs.setdefault('id', uuid.uuid4().hex)%0A        kwargs.setdefault('description', uuid.uuid4().hex)%0A        kwargs.setdefault('enabled', True)%0A        return kwargs%0A%0A    def test_positional_parameters_expect_fail(self):%0A        %22%22%22Ensure CrudManager raises TypeError exceptions.%0A%0A        After passing wrong number of positional arguments%0A        an exception should be raised.%0A%0A        Operations to be tested:%0A            * create()%0A            * get()%0A            * list()%0A            * delete()%0A            * update()%0A%0A        %22%22%22%0A        POS_PARAM_1 = uuid.uuid4().hex%0A        POS_PARAM_2 = uuid.uuid4().hex%0A        POS_PARAM_3 = uuid.uuid4().hex%0A%0A        PARAMETERS = %7B%0A            'create': (POS_PARAM_1, POS_PARAM_2),%0A            'get': (POS_PARAM_1, POS_PARAM_2),%0A            'list': (POS_PARAM_1, POS_PARAM_2),%0A            'update': (POS_PARAM_1, POS_PARAM_2, POS_PARAM_3),%0A            'delete': (POS_PARAM_1, POS_PARAM_2)%0A        %7D%0A%0A        for f_name, args in PARAMETERS.items():%0A            self.assertRaises(TypeError, getattr(self.manager, f_name),%0A                              *args)%0A%0A    @httpretty.activate%0A    def test_create(self, ref=None, req_ref=None):%0A        ref = ref or self.new_ref()%0A%0A        # req_ref argument allows you to specify a different%0A        # signature for the request when the manager does some%0A        # conversion before doing the request (e.g converting%0A        # from datetime object to timestamp string)%0A        req_ref = (req_ref or ref).copy()%0A        req_ref.pop('id')%0A%0A        self.stub_entity(httpretty.PUT, entity=ref, id=ref%5B'id'%5D, status=201)%0A%0A        returned = self.manager.create(**ref)%0A        self.assertIsInstance(returned, self.model)%0A        for attr in req_ref:%0A            self.assertEqual(%0A                getattr(returned, attr),%0A                req_ref%5Battr%5D,%0A                'Expected different %25s' %25 attr)%0A        self.assertEntityRequestBodyIs(req_ref)%0A

Add CRUD operations for Identity Providers.