"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/tests/unit/test_v3_os_revoke.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_v3_os_revoke.py  (keystone-16.0.1):test_v3_os_revoke.py  (keystone-17.0.0)
skipping to change at line 14 skipping to change at line 14
# #
# 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 datetime import datetime
import mock from unittest import mock
import uuid import uuid
import freezegun import freezegun
import http.client
from oslo_db import exception as oslo_db_exception from oslo_db import exception as oslo_db_exception
from oslo_utils import timeutils from oslo_utils import timeutils
import six
from six.moves import http_client
from testtools import matchers from testtools import matchers
from keystone.common import provider_api from keystone.common import provider_api
from keystone.common import utils from keystone.common import utils
from keystone.models import revoke_model from keystone.models import revoke_model
from keystone.tests.unit import test_v3 from keystone.tests.unit import test_v3
PROVIDERS = provider_api.ProviderAPIs PROVIDERS = provider_api.ProviderAPIs
def _future_time_string(): def _future_time_string():
skipping to change at line 81 skipping to change at line 80
def test_revoked_list_self_url(self): def test_revoked_list_self_url(self):
revoked_list_url = '/OS-REVOKE/events' revoked_list_url = '/OS-REVOKE/events'
resp = self.get(revoked_list_url) resp = self.get(revoked_list_url)
links = resp.json_body['links'] links = resp.json_body['links']
self.assertThat(links['self'], matchers.EndsWith(revoked_list_url)) self.assertThat(links['self'], matchers.EndsWith(revoked_list_url))
def test_revoked_token_in_list(self): def test_revoked_token_in_list(self):
audit_id = uuid.uuid4().hex audit_id = uuid.uuid4().hex
sample = self._blank_event() sample = self._blank_event()
sample['audit_id'] = six.text_type(audit_id) sample['audit_id'] = str(audit_id)
before_time = timeutils.utcnow().replace(microsecond=0) before_time = timeutils.utcnow().replace(microsecond=0)
PROVIDERS.revoke_api.revoke_by_audit_id(audit_id) PROVIDERS.revoke_api.revoke_by_audit_id(audit_id)
resp = self.get('/OS-REVOKE/events') resp = self.get('/OS-REVOKE/events')
events = resp.json_body['events'] events = resp.json_body['events']
self.assertEqual(1, len(events)) self.assertEqual(1, len(events))
self.assertReportedEventMatchesRecorded(events[0], sample, before_time) self.assertReportedEventMatchesRecorded(events[0], sample, before_time)
def test_disabled_project_in_list(self): def test_disabled_project_in_list(self):
project_id = uuid.uuid4().hex project_id = uuid.uuid4().hex
sample = dict() sample = dict()
sample['project_id'] = six.text_type(project_id) sample['project_id'] = str(project_id)
before_time = timeutils.utcnow().replace(microsecond=0) before_time = timeutils.utcnow().replace(microsecond=0)
PROVIDERS.revoke_api.revoke( PROVIDERS.revoke_api.revoke(
revoke_model.RevokeEvent(project_id=project_id)) revoke_model.RevokeEvent(project_id=project_id))
resp = self.get('/OS-REVOKE/events') resp = self.get('/OS-REVOKE/events')
events = resp.json_body['events'] events = resp.json_body['events']
self.assertEqual(1, len(events)) self.assertEqual(1, len(events))
self.assertReportedEventMatchesRecorded(events[0], sample, before_time) self.assertReportedEventMatchesRecorded(events[0], sample, before_time)
def test_disabled_domain_in_list(self): def test_disabled_domain_in_list(self):
domain_id = uuid.uuid4().hex domain_id = uuid.uuid4().hex
sample = dict() sample = dict()
sample['domain_id'] = six.text_type(domain_id) sample['domain_id'] = str(domain_id)
before_time = timeutils.utcnow().replace(microsecond=0) before_time = timeutils.utcnow().replace(microsecond=0)
PROVIDERS.revoke_api.revoke( PROVIDERS.revoke_api.revoke(
revoke_model.RevokeEvent(domain_id=domain_id)) revoke_model.RevokeEvent(domain_id=domain_id))
resp = self.get('/OS-REVOKE/events') resp = self.get('/OS-REVOKE/events')
events = resp.json_body['events'] events = resp.json_body['events']
self.assertEqual(1, len(events)) self.assertEqual(1, len(events))
self.assertReportedEventMatchesRecorded(events[0], sample, before_time) self.assertReportedEventMatchesRecorded(events[0], sample, before_time)
def test_list_since_invalid(self): def test_list_since_invalid(self):
self.get('/OS-REVOKE/events?since=blah', self.get('/OS-REVOKE/events?since=blah',
expected_status=http_client.BAD_REQUEST) expected_status=http.client.BAD_REQUEST)
def test_list_since_valid(self): def test_list_since_valid(self):
resp = self.get('/OS-REVOKE/events?since=2013-02-27T18:30:59.999999Z') resp = self.get('/OS-REVOKE/events?since=2013-02-27T18:30:59.999999Z')
events = resp.json_body['events'] events = resp.json_body['events']
self.assertEqual(0, len(events)) self.assertEqual(0, len(events))
def test_since_future_time_no_events(self): def test_since_future_time_no_events(self):
domain_id = uuid.uuid4().hex domain_id = uuid.uuid4().hex
sample = dict() sample = dict()
sample['domain_id'] = six.text_type(domain_id) sample['domain_id'] = str(domain_id)
PROVIDERS.revoke_api.revoke( PROVIDERS.revoke_api.revoke(
revoke_model.RevokeEvent(domain_id=domain_id)) revoke_model.RevokeEvent(domain_id=domain_id))
resp = self.get('/OS-REVOKE/events') resp = self.get('/OS-REVOKE/events')
events = resp.json_body['events'] events = resp.json_body['events']
self.assertEqual(1, len(events)) self.assertEqual(1, len(events))
resp = self.get('/OS-REVOKE/events?since=%s' % _future_time_string()) resp = self.get('/OS-REVOKE/events?since=%s' % _future_time_string())
events = resp.json_body['events'] events = resp.json_body['events']
 End of changes. 8 change blocks. 
8 lines changed or deleted 7 lines changed or added

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