"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/tests/unit/common/test_notifications.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_notifications.py  (keystone-16.0.1):test_notifications.py  (keystone-17.0.0)
skipping to change at line 16 skipping to change at line 16
# #
# 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
from unittest import mock
import uuid import uuid
import fixtures import fixtures
import freezegun import freezegun
import mock import http.client
from oslo_config import fixture as config_fixture from oslo_config import fixture as config_fixture
from oslo_log import log from oslo_log import log
import oslo_messaging import oslo_messaging
from pycadf import cadftaxonomy from pycadf import cadftaxonomy
from pycadf import cadftype from pycadf import cadftype
from pycadf import eventfactory from pycadf import eventfactory
from pycadf import resource as cadfresource from pycadf import resource as cadfresource
from six.moves import http_client
from keystone.common import provider_api from keystone.common import provider_api
import keystone.conf import keystone.conf
from keystone import exception from keystone import exception
from keystone import notifications from keystone import notifications
from keystone.tests import unit from keystone.tests import unit
from keystone.tests.unit import test_v3 from keystone.tests.unit import test_v3
CONF = keystone.conf.CONF CONF = keystone.conf.CONF
PROVIDERS = provider_api.ProviderAPIs PROVIDERS = provider_api.ProviderAPIs
skipping to change at line 1230 skipping to change at line 1230
password=password) password=password)
self.post('/auth/tokens', body=data) self.post('/auth/tokens', body=data)
self._assert_last_note(self.ACTION, user_id) self._assert_last_note(self.ACTION, user_id)
def test_v3_authenticate_with_invalid_user_id_sends_notification(self): def test_v3_authenticate_with_invalid_user_id_sends_notification(self):
user_id = uuid.uuid4().hex user_id = uuid.uuid4().hex
password = self.user['password'] password = self.user['password']
data = self.build_authentication_request(user_id=user_id, data = self.build_authentication_request(user_id=user_id,
password=password) password=password)
self.post('/auth/tokens', body=data, self.post('/auth/tokens', body=data,
expected_status=http_client.UNAUTHORIZED) expected_status=http.client.UNAUTHORIZED)
note = self._get_last_note() note = self._get_last_note()
initiator = note['initiator'] initiator = note['initiator']
# Confirm user-name specific event was emitted. # Confirm user-name specific event was emitted.
self.assertEqual(self.ACTION, note['action']) self.assertEqual(self.ACTION, note['action'])
self.assertEqual(user_id, initiator.user_id) self.assertEqual(user_id, initiator.user_id)
self.assertTrue(note['send_notification_called']) self.assertTrue(note['send_notification_called'])
self.assertEqual(cadftaxonomy.OUTCOME_FAILURE, note['event'].outcome) self.assertEqual(cadftaxonomy.OUTCOME_FAILURE, note['event'].outcome)
self.assertEqual(self.LOCAL_HOST, initiator.host.address) self.assertEqual(self.LOCAL_HOST, initiator.host.address)
def test_v3_authenticate_with_invalid_user_name_sends_notification(self): def test_v3_authenticate_with_invalid_user_name_sends_notification(self):
user_name = uuid.uuid4().hex user_name = uuid.uuid4().hex
password = self.user['password'] password = self.user['password']
domain_id = self.domain_id domain_id = self.domain_id
data = self.build_authentication_request(username=user_name, data = self.build_authentication_request(username=user_name,
user_domain_id=domain_id, user_domain_id=domain_id,
password=password) password=password)
self.post('/auth/tokens', body=data, self.post('/auth/tokens', body=data,
expected_status=http_client.UNAUTHORIZED) expected_status=http.client.UNAUTHORIZED)
note = self._get_last_note() note = self._get_last_note()
initiator = note['initiator'] initiator = note['initiator']
# Confirm user-name specific event was emitted. # Confirm user-name specific event was emitted.
self.assertEqual(self.ACTION, note['action']) self.assertEqual(self.ACTION, note['action'])
self.assertEqual(user_name, initiator.user_name) self.assertEqual(user_name, initiator.user_name)
self.assertEqual(domain_id, initiator.domain_id) self.assertEqual(domain_id, initiator.domain_id)
self.assertTrue(note['send_notification_called']) self.assertTrue(note['send_notification_called'])
self.assertEqual(cadftaxonomy.OUTCOME_FAILURE, note['event'].outcome) self.assertEqual(cadftaxonomy.OUTCOME_FAILURE, note['event'].outcome)
self.assertEqual(self.LOCAL_HOST, initiator.host.address) self.assertEqual(self.LOCAL_HOST, initiator.host.address)
 End of changes. 5 change blocks. 
4 lines changed or deleted 4 lines changed or added

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