"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/tests/protection/v3/test_protocols.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_protocols.py  (keystone-16.0.1):test_protocols.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 91 skipping to change at line 91
protocol_id = 'saml2' protocol_id = 'saml2'
create = {'protocol': {'mapping_id': mapping['id']}} create = {'protocol': {'mapping_id': mapping['id']}}
with self.test_client() as c: with self.test_client() as c:
path = ( path = (
'/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' % '/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' %
(identity_provider['id'], protocol_id) (identity_provider['id'], protocol_id)
) )
c.put( c.put(
path, json=create, headers=self.headers, path, json=create, headers=self.headers,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
def test_user_cannot_update_protocols(self): def test_user_cannot_update_protocols(self):
protocol, mapping, identity_provider = self._create_protocol_and_deps() protocol, mapping, identity_provider = self._create_protocol_and_deps()
new_mapping = PROVIDERS.federation_api.create_mapping( new_mapping = PROVIDERS.federation_api.create_mapping(
uuid.uuid4().hex, unit.new_mapping_ref() uuid.uuid4().hex, unit.new_mapping_ref()
) )
update = {'protocol': {'mapping_id': new_mapping['id']}} update = {'protocol': {'mapping_id': new_mapping['id']}}
with self.test_client() as c: with self.test_client() as c:
path = ( path = (
'/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' % '/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' %
(identity_provider['id'], protocol['id']) (identity_provider['id'], protocol['id'])
) )
c.patch( c.patch(
path, json=update, headers=self.headers, path, json=update, headers=self.headers,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
def test_user_cannot_delete_protocol(self): def test_user_cannot_delete_protocol(self):
protocol, mapping, identity_provider = self._create_protocol_and_deps() protocol, mapping, identity_provider = self._create_protocol_and_deps()
with self.test_client() as c: with self.test_client() as c:
path = ( path = (
'/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' % '/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' %
(identity_provider['id'], protocol['id']) (identity_provider['id'], protocol['id'])
) )
c.delete( c.delete(
path, headers=self.headers, path, headers=self.headers,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
class _DomainAndProjectUserProtocolTests(object): class _DomainAndProjectUserProtocolTests(object):
def test_user_cannot_create_protocols(self): def test_user_cannot_create_protocols(self):
identity_provider = unit.new_identity_provider_ref() identity_provider = unit.new_identity_provider_ref()
identity_provider = PROVIDERS.federation_api.create_idp( identity_provider = PROVIDERS.federation_api.create_idp(
identity_provider['id'], identity_provider identity_provider['id'], identity_provider
) )
skipping to change at line 147 skipping to change at line 147
protocol_id = 'saml2' protocol_id = 'saml2'
create = {'protocol': {'mapping_id': mapping['id']}} create = {'protocol': {'mapping_id': mapping['id']}}
with self.test_client() as c: with self.test_client() as c:
path = ( path = (
'/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' % '/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' %
(identity_provider['id'], protocol_id) (identity_provider['id'], protocol_id)
) )
c.put( c.put(
path, json=create, headers=self.headers, path, json=create, headers=self.headers,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
def test_user_cannot_update_protocols(self): def test_user_cannot_update_protocols(self):
protocol, mapping, identity_provider = self._create_protocol_and_deps() protocol, mapping, identity_provider = self._create_protocol_and_deps()
new_mapping = PROVIDERS.federation_api.create_mapping( new_mapping = PROVIDERS.federation_api.create_mapping(
uuid.uuid4().hex, unit.new_mapping_ref() uuid.uuid4().hex, unit.new_mapping_ref()
) )
update = {'protocol': {'mapping_id': new_mapping['id']}} update = {'protocol': {'mapping_id': new_mapping['id']}}
with self.test_client() as c: with self.test_client() as c:
path = ( path = (
'/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' % '/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' %
(identity_provider['id'], protocol['id']) (identity_provider['id'], protocol['id'])
) )
c.patch( c.patch(
path, json=update, headers=self.headers, path, json=update, headers=self.headers,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
def test_user_cannot_delete_protocol(self): def test_user_cannot_delete_protocol(self):
protocol, mapping, identity_provider = self._create_protocol_and_deps() protocol, mapping, identity_provider = self._create_protocol_and_deps()
with self.test_client() as c: with self.test_client() as c:
path = ( path = (
'/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' % '/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' %
(identity_provider['id'], protocol['id']) (identity_provider['id'], protocol['id'])
) )
c.delete( c.delete(
path, headers=self.headers, path, headers=self.headers,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
def test_user_cannot_list_protocols(self): def test_user_cannot_list_protocols(self):
protocol, mapping, identity_provider = self._create_protocol_and_deps() protocol, mapping, identity_provider = self._create_protocol_and_deps()
with self.test_client() as c: with self.test_client() as c:
path = ( path = (
'/v3/OS-FEDERATION/identity_providers/%s/protocols' % '/v3/OS-FEDERATION/identity_providers/%s/protocols' %
identity_provider['id'] identity_provider['id']
) )
c.get( c.get(
path, headers=self.headers, path, headers=self.headers,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
def test_user_cannot_get_a_protocol(self): def test_user_cannot_get_a_protocol(self):
protocol, mapping, identity_provider = self._create_protocol_and_deps() protocol, mapping, identity_provider = self._create_protocol_and_deps()
with self.test_client() as c: with self.test_client() as c:
path = ( path = (
'/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' % '/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' %
(identity_provider['id'], protocol['id']) (identity_provider['id'], protocol['id'])
) )
c.get( c.get(
path, headers=self.headers, path, 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,
_CommonUtilities, _CommonUtilities,
_SystemUserProtocolTests, _SystemUserProtocolTests,
_SystemReaderAndMemberProtocolTests): _SystemReaderAndMemberProtocolTests):
def setUp(self): def setUp(self):
super(SystemReaderTests, self).setUp() super(SystemReaderTests, self).setUp()
skipping to change at line 322 skipping to change at line 322
protocol_id = 'saml2' protocol_id = 'saml2'
create = {'protocol': {'mapping_id': mapping['id']}} create = {'protocol': {'mapping_id': mapping['id']}}
with self.test_client() as c: with self.test_client() as c:
path = ( path = (
'/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' % '/v3/OS-FEDERATION/identity_providers/%s/protocols/%s' %
(identity_provider['id'], protocol_id) (identity_provider['id'], protocol_id)
) )
c.put( c.put(
path, json=create, headers=self.headers, path, json=create, headers=self.headers,
expected_status_code=http_client.CREATED expected_status_code=http.client.CREATED
) )
def test_user_can_update_protocols(self): def test_user_can_update_protocols(self):
protocol, mapping, identity_provider = self._create_protocol_and_deps() protocol, mapping, identity_provider = self._create_protocol_and_deps()
new_mapping = PROVIDERS.federation_api.create_mapping( new_mapping = PROVIDERS.federation_api.create_mapping(
uuid.uuid4().hex, unit.new_mapping_ref() uuid.uuid4().hex, unit.new_mapping_ref()
) )
update = {'protocol': {'mapping_id': new_mapping['id']}} update = {'protocol': {'mapping_id': new_mapping['id']}}
 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)