示例#1
0
    def test_invalid_event(self, mock_update_bundle, mock_remove_bundle,
                           mock_error):
        handler = NotificationHandler(self.bundle_uuid, self.bundle_version,
                                      "INVALID")
        handler.run()

        self.assertFalse(mock_update_bundle.called)
        self.assertFalse(mock_remove_bundle.called)
        self.assertTrue(mock_error.called)
示例#2
0
def notification_handler(event, context):
    notification = json.loads(event["Records"][0]["body"])
    assert ('bundle_uuid' in notification and 'bundle_version' in notification
            and 'event_type' in notification)

    bundle_uuid = notification["bundle_uuid"]
    bundle_version = notification["bundle_version"]
    event_type = notification["event_type"]

    notification_handler = NotificationHandler(bundle_uuid, bundle_version,
                                               event_type)
    notification_handler.run()
示例#3
0
    def test_delete_event(self, mock_remove_bundle):
        handler = NotificationHandler(self.bundle_uuid, self.bundle_version,
                                      "DELETE")
        handler.run()

        mock_remove_bundle.assert_called_once_with()
示例#4
0
    def test_tombstone_event(self, mock_remove_bundle):
        handler = NotificationHandler(self.bundle_uuid, self.bundle_version,
                                      "TOMBSTONE")
        handler.run()

        mock_remove_bundle.assert_called_once_with()
示例#5
0
    def test_update_event(self, mock_update_bundle):
        handler = NotificationHandler(self.bundle_uuid, self.bundle_version,
                                      "UPDATE")
        handler.run()

        mock_update_bundle.assert_called_once_with()