"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/tests/unit/test_v3_filters.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_filters.py  (keystone-16.0.1):test_v3_filters.py  (keystone-17.0.0)
skipping to change at line 19 skipping to change at line 19
# #
# 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 freezegun import freezegun
import http.client
from oslo_config import fixture as config_fixture from oslo_config import fixture as config_fixture
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from six.moves import http_client
from six.moves import range
from keystone.common import provider_api from keystone.common import provider_api
import keystone.conf import keystone.conf
from keystone.tests import unit from keystone.tests import unit
from keystone.tests.unit import filtering from keystone.tests.unit import filtering
from keystone.tests.unit import ksfixtures from keystone.tests.unit import ksfixtures
from keystone.tests.unit.ksfixtures import temporaryfile from keystone.tests.unit.ksfixtures import temporaryfile
from keystone.tests.unit import test_v3 from keystone.tests.unit import test_v3
CONF = keystone.conf.CONF CONF = keystone.conf.CONF
skipping to change at line 544 skipping to change at line 543
def test_list_users_by_password_expires_with_bad_operator_fails(self): def test_list_users_by_password_expires_with_bad_operator_fails(self):
"""Ensure an invalid operator returns a Bad Request. """Ensure an invalid operator returns a Bad Request.
GET /users?password_expires_at={invalid_operator}:{timestamp} GET /users?password_expires_at={invalid_operator}:{timestamp}
GET /users?password_expires_at={operator}:{timestamp}& GET /users?password_expires_at={operator}:{timestamp}&
{invalid_operator}:{timestamp} {invalid_operator}:{timestamp}
""" """
bad_op_url = self._list_users_by_password_expires_at( bad_op_url = self._list_users_by_password_expires_at(
self._format_timestamp(self.starttime), 'x') self._format_timestamp(self.starttime), 'x')
self.get(bad_op_url, expected_status=http_client.BAD_REQUEST) self.get(bad_op_url, expected_status=http.client.BAD_REQUEST)
bad_op_url = self._list_users_by_multiple_password_expires_at( bad_op_url = self._list_users_by_multiple_password_expires_at(
self._format_timestamp(self.starttime), 'lt', self._format_timestamp(self.starttime), 'lt',
self._format_timestamp(self.starttime), 'x') self._format_timestamp(self.starttime), 'x')
self.get(bad_op_url, expected_status=http_client.BAD_REQUEST) self.get(bad_op_url, expected_status=http.client.BAD_REQUEST)
def test_list_users_by_password_expires_with_bad_timestamp_fails(self): def test_list_users_by_password_expires_with_bad_timestamp_fails(self):
"""Ensure an invalid timestamp returns a Bad Request. """Ensure an invalid timestamp returns a Bad Request.
GET /users?password_expires_at={invalid_timestamp} GET /users?password_expires_at={invalid_timestamp}
GET /users?password_expires_at={operator}:{timestamp}& GET /users?password_expires_at={operator}:{timestamp}&
{operator}:{invalid_timestamp} {operator}:{invalid_timestamp}
""" """
bad_ts_url = self._list_users_by_password_expires_at( bad_ts_url = self._list_users_by_password_expires_at(
self.starttime.strftime('%S:%M:%ST%Y-%m-%d')) self.starttime.strftime('%S:%M:%ST%Y-%m-%d'))
self.get(bad_ts_url, expected_status=http_client.BAD_REQUEST) self.get(bad_ts_url, expected_status=http.client.BAD_REQUEST)
bad_ts_url = self._list_users_by_multiple_password_expires_at( bad_ts_url = self._list_users_by_multiple_password_expires_at(
self._format_timestamp(self.starttime), 'lt', self._format_timestamp(self.starttime), 'lt',
self.starttime.strftime('%S:%M:%ST%Y-%m-%d'), 'gt') self.starttime.strftime('%S:%M:%ST%Y-%m-%d'), 'gt')
self.get(bad_ts_url, expected_status=http_client.BAD_REQUEST) self.get(bad_ts_url, expected_status=http.client.BAD_REQUEST)
def _list_users_in_group_by_password_expires_at( def _list_users_in_group_by_password_expires_at(
self, time, operator=None, expected_status=http_client.OK): self, time, operator=None, expected_status=http.client.OK):
"""Call `list_users_in_group` with `password_expires_at` filter. """Call `list_users_in_group` with `password_expires_at` filter.
GET /groups/{group_id}/users?password_expires_at= GET /groups/{group_id}/users?password_expires_at=
{operator}:{timestamp}&{operator}:{timestamp} {operator}:{timestamp}&{operator}:{timestamp}
""" """
url = '/groups/' + self.group_id + '/users?password_expires_at=' url = '/groups/' + self.group_id + '/users?password_expires_at='
if operator: if operator:
url += operator + ':' url += operator + ':'
url += str(time) url += str(time)
return url return url
def _list_users_in_group_by_multiple_password_expires_at( def _list_users_in_group_by_multiple_password_expires_at(
self, first_time, first_operator, second_time, second_operator, self, first_time, first_operator, second_time, second_operator,
expected_status=http_client.OK): expected_status=http.client.OK):
"""Call `list_users_in_group` with two `password_expires_at` filters. """Call `list_users_in_group` with two `password_expires_at` filters.
GET /groups/{group_id}/users?password_expires_at= GET /groups/{group_id}/users?password_expires_at=
{operator}:{timestamp}&{operator}:{timestamp} {operator}:{timestamp}&{operator}:{timestamp}
""" """
url = ('/groups/' + self.group_id + '/users' url = ('/groups/' + self.group_id + '/users'
'?password_expires_at=%s:%s&password_expires_at=%s:%s' % '?password_expires_at=%s:%s&password_expires_at=%s:%s' %
(first_operator, first_time, second_operator, second_time)) (first_operator, first_time, second_operator, second_time))
return url return url
skipping to change at line 703 skipping to change at line 702
"""Ensure an invalid operator returns a Bad Request. """Ensure an invalid operator returns a Bad Request.
GET /groups/{groupid}/users?password_expires_at= GET /groups/{groupid}/users?password_expires_at=
{invalid_operator}:{timestamp} {invalid_operator}:{timestamp}
GET /groups/{group_id}/users?password_expires_at= GET /groups/{group_id}/users?password_expires_at=
{operator}:{timestamp}&{invalid_operator}:{timestamp} {operator}:{timestamp}&{invalid_operator}:{timestamp}
""" """
bad_op_url = self._list_users_in_group_by_password_expires_at( bad_op_url = self._list_users_in_group_by_password_expires_at(
self._format_timestamp(self.starttime), 'bad') self._format_timestamp(self.starttime), 'bad')
self.get(bad_op_url, expected_status=http_client.BAD_REQUEST) self.get(bad_op_url, expected_status=http.client.BAD_REQUEST)
bad_op_url = self._list_users_in_group_by_multiple_password_expires_at( bad_op_url = self._list_users_in_group_by_multiple_password_expires_at(
self._format_timestamp(self.starttime), 'lt', self._format_timestamp(self.starttime), 'lt',
self._format_timestamp(self.starttime), 'x') self._format_timestamp(self.starttime), 'x')
self.get(bad_op_url, expected_status=http_client.BAD_REQUEST) self.get(bad_op_url, expected_status=http.client.BAD_REQUEST)
def test_list_users_in_group_by_password_expires_bad_timestamp_fails(self): def test_list_users_in_group_by_password_expires_bad_timestamp_fails(self):
"""Ensure and invalid timestamp returns a Bad Request. """Ensure and invalid timestamp returns a Bad Request.
GET /groups/{groupid}/users?password_expires_at={invalid_timestamp} GET /groups/{groupid}/users?password_expires_at={invalid_timestamp}
GET /groups/{groupid}/users?password_expires_at={operator}:{timestamp}& GET /groups/{groupid}/users?password_expires_at={operator}:{timestamp}&
{operator}:{invalid_timestamp} {operator}:{invalid_timestamp}
""" """
bad_ts_url = self._list_users_in_group_by_password_expires_at( bad_ts_url = self._list_users_in_group_by_password_expires_at(
self.starttime.strftime('%S:%M:%ST%Y-%m-%d')) self.starttime.strftime('%S:%M:%ST%Y-%m-%d'))
self.get(bad_ts_url, expected_status=http_client.BAD_REQUEST) self.get(bad_ts_url, expected_status=http.client.BAD_REQUEST)
bad_ts_url = self._list_users_in_group_by_multiple_password_expires_at( bad_ts_url = self._list_users_in_group_by_multiple_password_expires_at(
self._format_timestamp(self.starttime), 'lt', self._format_timestamp(self.starttime), 'lt',
self.starttime.strftime('%S:%M:%ST%Y-%m-%d'), 'gt') self.starttime.strftime('%S:%M:%ST%Y-%m-%d'), 'gt')
self.get(bad_ts_url, expected_status=http_client.BAD_REQUEST) self.get(bad_ts_url, expected_status=http.client.BAD_REQUEST)
class IdentityTestListLimitCase(IdentityTestFilteredCase): class IdentityTestListLimitCase(IdentityTestFilteredCase):
"""Test list limiting enforcement on the v3 Identity API.""" """Test list limiting enforcement on the v3 Identity API."""
content_type = 'json' content_type = 'json'
def setUp(self): def setUp(self):
"""Setup for Identity Limit Test Cases.""" """Setup for Identity Limit Test Cases."""
super(IdentityTestListLimitCase, self).setUp() super(IdentityTestListLimitCase, self).setUp()
 End of changes. 12 change blocks. 
12 lines changed or deleted 11 lines changed or added

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