Esempio n. 1
0
    def test_handle_event_with_serialize_error(self, mock_create):
        # Setup
        notifier_config = {'url': 'https://localhost/api/'}

        event = Event('type-1', {'k1': 'v1', '_id': _test_objid()})

        mock_connection = mock.Mock()
        mock_response = mock.Mock()

        mock_response.status = httplib.NOT_FOUND

        mock_connection.getresponse.return_value = mock_response
        mock_create.return_value = mock_connection

        # Test
        http.handle_event(notifier_config, event)  # should not throw TypeError
Esempio n. 2
0
    def test_handle_event_with_serialize_error(self, mock_create):
        # Setup
        notifier_config = {'url' : 'https://localhost/api/'}

        event = Event('type-1', {'k1' : 'v1', '_id': _test_objid()})

        mock_connection = mock.Mock()
        mock_response = mock.Mock()

        mock_response.status = httplib.NOT_FOUND

        mock_connection.getresponse.return_value = mock_response
        mock_create.return_value = mock_connection

        # Test
        http.handle_event(notifier_config, event) # should not throw TypeError
Esempio n. 3
0
    def test_handle_event_with_serialize_error(self, mock_create):
        # Setup
        notifier_config = {"url": "https://localhost/api/"}

        event = Event("type-1", {"k1": "v1", "_id": _test_objid()})

        mock_connection = mock.Mock()
        mock_response = mock.Mock()

        mock_response.status = httplib.NOT_FOUND

        mock_connection.getresponse.return_value = mock_response
        mock_create.return_value = mock_connection

        # Test
        http.handle_event(notifier_config, event)  # should not throw TypeError
Esempio n. 4
0
 def test_publish_serialize_objectid(self, mock_connection):
     mock_event = mock.MagicMock()
     mock_event.data.return_value = {'foo': _test_objid()}
     mock_event.event_type = data.TYPE_REPO_PUBLISH_FINISHED
     # no TypeError = success
     self.manager.publish(mock_event, 'pulp')
Esempio n. 5
0
 def test_publish_serialize_objectid(self, mock_connection):
     mock_event = mock.MagicMock()
     mock_event.data.return_value = {'foo': _test_objid()}
     mock_event.event_type = data.TYPE_REPO_PUBLISH_FINISHED
     # no TypeError = success
     self.manager.publish(mock_event, 'pulp')
Esempio n. 6
0
 def test_email_serialize_objid(self, mock_smtp, mock_getbool, mock_task_ser):
     event_with_id = data.Event('test-1', {'foo': _test_objid()})
     mock_task_ser.return_value = 'serialized task'
     # no TypeError = success
     mail.handle_event(self.notifier_config, event_with_id)
Esempio n. 7
0
 def test_email_serialize_objid(self, mock_smtp, mock_getbool):
     event_with_id = data.Event('test-1', {'foo': _test_objid()})
     # no TypeError = success
     mail.handle_event(self.notifier_config, event_with_id)
Esempio n. 8
0
 def test_email_serialize_objid(self, mock_smtp, mock_getbool):
     event_with_id = Event('test-1', {'foo': _test_objid()})
     # no TypeError = success
     mail.handle_event(self.notifier_config, event_with_id)