pushkin.request.requests.NotificationRequestBatch

Here are the examples of the python api pushkin.request.requests.NotificationRequestBatch taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

Example 1

Project: pushkin Source File: notifications.py
    def create_request(self, requests):
        valid_requests = []
        validator = ProtoNotificationValidator()
        for request in requests:
            if validator.validate_single(request):
                valid_requests.append(NotificationRequestSingle(request.login_id, request.title, request.content))

        return NotificationRequestBatch(valid_requests)

Example 2

Project: pushkin Source File: notifications.py
    def create_request(self, requests):
        valid_requests = []
        validator = JsonNotificationValidator()
        for request in requests:
            if validator.validate_single(request):
                valid_requests.append(NotificationRequestSingle(request['login_id'], request['title'], request['content']))

        return NotificationRequestBatch(valid_requests)

Example 3

Project: pushkin Source File: test_notification_request_batch.py
def test_notification_proto_empty_screen_process(mocker, mock_log):
    '''Test that a valid notification proto without screen can be processed.'''
    mocker.patch('pushkin.database.database.get_raw_messages')
    notification = NotificationRequestSingle(1338, "Msg title", "Text of a message.")
    NotificationRequestBatch([notification]).process_single(notification)
    database.get_raw_messages.assert_called_with(1338, "Msg title", "Text of a message.", "", config.game,
                                                 config.world_id, config.dry_run)