"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/tests/protection/v3/test_service_providers.py" between
keystone-16.0.1.tar.gz and keystone-17.0.0.tar.gz

About: OpenStack Keystone (Core Service: Identity) provides an authentication and authorization service for other OpenStack services. Provides a catalog of endpoints for all OpenStack services.
The "Ussuri" series (latest release).

test_service_providers.py  (keystone-16.0.1):test_service_providers.py  (keystone-17.0.0)
skipping to change at line 15 skipping to change at line 15
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import uuid import uuid
from six.moves import http_client import http.client
from keystone.common import provider_api from keystone.common import provider_api
import keystone.conf import keystone.conf
from keystone.tests.common import auth as common_auth from keystone.tests.common import auth as common_auth
from keystone.tests import unit from keystone.tests import unit
from keystone.tests.unit import base_classes from keystone.tests.unit import base_classes
from keystone.tests.unit import ksfixtures from keystone.tests.unit import ksfixtures
CONF = keystone.conf.CONF CONF = keystone.conf.CONF
PROVIDERS = provider_api.ProviderAPIs PROVIDERS = provider_api.ProviderAPIs
skipping to change at line 75 skipping to change at line 75
) )
service_provider = unit.new_service_provider_ref() service_provider = unit.new_service_provider_ref()
create = {'service_provider': service_provider} create = {'service_provider': service_provider}
with self.test_client() as c: with self.test_client() as c:
c.put( c.put(
'/v3/OS-FEDERATION/service_providers/%s' % uuid.uuid4().hex, '/v3/OS-FEDERATION/service_providers/%s' % uuid.uuid4().hex,
headers=self.headers, headers=self.headers,
json=create, json=create,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
def test_user_cannot_update_service_providers(self): def test_user_cannot_update_service_providers(self):
service_provider = PROVIDERS.federation_api.create_sp( service_provider = PROVIDERS.federation_api.create_sp(
uuid.uuid4().hex, unit.new_service_provider_ref() uuid.uuid4().hex, unit.new_service_provider_ref()
) )
update = {'service_provider': {'enabled': False}} update = {'service_provider': {'enabled': False}}
with self.test_client() as c: with self.test_client() as c:
c.patch( c.patch(
'/v3/OS-FEDERATION/service_providers/%s' % '/v3/OS-FEDERATION/service_providers/%s' %
service_provider['id'], service_provider['id'],
headers=self.headers, headers=self.headers,
json=update, json=update,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
def test_user_cannot_delete_service_providers(self): def test_user_cannot_delete_service_providers(self):
service_provider = PROVIDERS.federation_api.create_sp( service_provider = PROVIDERS.federation_api.create_sp(
uuid.uuid4().hex, unit.new_service_provider_ref() uuid.uuid4().hex, unit.new_service_provider_ref()
) )
with self.test_client() as c: with self.test_client() as c:
c.delete( c.delete(
'/v3/OS-FEDERATION/service_providers/%s' % '/v3/OS-FEDERATION/service_providers/%s' %
service_provider['id'], service_provider['id'],
headers=self.headers, headers=self.headers,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
class _DomainAndProjectUserServiceProviderTests(object): class _DomainAndProjectUserServiceProviderTests(object):
"""Common functionality for all domain and project users.""" """Common functionality for all domain and project users."""
def test_user_cannot_create_service_providers(self): def test_user_cannot_create_service_providers(self):
service_provider = PROVIDERS.federation_api.create_sp( service_provider = PROVIDERS.federation_api.create_sp(
uuid.uuid4().hex, unit.new_service_provider_ref() uuid.uuid4().hex, unit.new_service_provider_ref()
) )
service_provider = unit.new_service_provider_ref() service_provider = unit.new_service_provider_ref()
create = {'service_provider': service_provider} create = {'service_provider': service_provider}
with self.test_client() as c: with self.test_client() as c:
c.put( c.put(
'/v3/OS-FEDERATION/service_providers/%s' % uuid.uuid4().hex, '/v3/OS-FEDERATION/service_providers/%s' % uuid.uuid4().hex,
headers=self.headers, headers=self.headers,
json=create, json=create,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
def test_user_cannot_update_service_providers(self): def test_user_cannot_update_service_providers(self):
service_provider = PROVIDERS.federation_api.create_sp( service_provider = PROVIDERS.federation_api.create_sp(
uuid.uuid4().hex, unit.new_service_provider_ref() uuid.uuid4().hex, unit.new_service_provider_ref()
) )
update = {'service_provider': {'enabled': False}} update = {'service_provider': {'enabled': False}}
with self.test_client() as c: with self.test_client() as c:
c.patch( c.patch(
'/v3/OS-FEDERATION/service_providers/%s' % '/v3/OS-FEDERATION/service_providers/%s' %
service_provider['id'], service_provider['id'],
headers=self.headers, headers=self.headers,
json=update, json=update,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
def test_user_cannot_list_service_providers(self): def test_user_cannot_list_service_providers(self):
PROVIDERS.federation_api.create_sp( PROVIDERS.federation_api.create_sp(
uuid.uuid4().hex, unit.new_service_provider_ref() uuid.uuid4().hex, unit.new_service_provider_ref()
) )
with self.test_client() as c: with self.test_client() as c:
c.get( c.get(
'/v3/OS-FEDERATION/service_providers', headers=self.headers, '/v3/OS-FEDERATION/service_providers', headers=self.headers,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
def test_user_cannot_get_a_service_provider(self): def test_user_cannot_get_a_service_provider(self):
service_provider = PROVIDERS.federation_api.create_sp( service_provider = PROVIDERS.federation_api.create_sp(
uuid.uuid4().hex, unit.new_service_provider_ref() uuid.uuid4().hex, unit.new_service_provider_ref()
) )
with self.test_client() as c: with self.test_client() as c:
c.get( c.get(
'/v3/OS-FEDERATION/service_providers/%s' % '/v3/OS-FEDERATION/service_providers/%s' %
service_provider['id'], service_provider['id'],
headers=self.headers, headers=self.headers,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
def test_user_cannot_delete_service_providers(self): def test_user_cannot_delete_service_providers(self):
service_provider = PROVIDERS.federation_api.create_sp( service_provider = PROVIDERS.federation_api.create_sp(
uuid.uuid4().hex, unit.new_service_provider_ref() uuid.uuid4().hex, unit.new_service_provider_ref()
) )
with self.test_client() as c: with self.test_client() as c:
c.delete( c.delete(
'/v3/OS-FEDERATION/service_providers/%s' % '/v3/OS-FEDERATION/service_providers/%s' %
service_provider['id'], service_provider['id'],
headers=self.headers, headers=self.headers,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
class SystemReaderTests(base_classes.TestCaseWithBootstrap, class SystemReaderTests(base_classes.TestCaseWithBootstrap,
common_auth.AuthTestMixin, common_auth.AuthTestMixin,
_SystemUserServiceProviderTests, _SystemUserServiceProviderTests,
_SystemReaderAndMemberUserServiceProviderTests): _SystemReaderAndMemberUserServiceProviderTests):
def setUp(self): def setUp(self):
super(SystemReaderTests, self).setUp() super(SystemReaderTests, self).setUp()
self.loadapp() self.loadapp()
skipping to change at line 284 skipping to change at line 284
) )
service_provider = unit.new_service_provider_ref() service_provider = unit.new_service_provider_ref()
create = {'service_provider': service_provider} create = {'service_provider': service_provider}
with self.test_client() as c: with self.test_client() as c:
c.put( c.put(
'/v3/OS-FEDERATION/service_providers/%s' % uuid.uuid4().hex, '/v3/OS-FEDERATION/service_providers/%s' % uuid.uuid4().hex,
headers=self.headers, headers=self.headers,
json=create, json=create,
expected_status_code=http_client.CREATED expected_status_code=http.client.CREATED
) )
def test_user_can_update_service_providers(self): def test_user_can_update_service_providers(self):
service_provider = PROVIDERS.federation_api.create_sp( service_provider = PROVIDERS.federation_api.create_sp(
uuid.uuid4().hex, unit.new_service_provider_ref() uuid.uuid4().hex, unit.new_service_provider_ref()
) )
update = {'service_provider': {'enabled': False}} update = {'service_provider': {'enabled': False}}
with self.test_client() as c: with self.test_client() as c:
 End of changes. 10 change blocks. 
10 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)