def test_dispatch_messages(): server = APNSProxyServer(dummy_setting) server.create_workers({ "myApp2": { "application_id": "myApp2", "name": "My App2", "sandbox": False, "cert_file": "sample.cert", "key_file": "sample.key" }, }, 1) token = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" eq_(server.dispatch_queue(json.dumps({ "token": token, "appid": "myApp2", "aps": { "content_available": True }, "test": True })), True) eq_(server.dispatch_queue(json.dumps({ "token": token, "appid": "myApp2", "aps": { "sound": None, "badge": 99 }, "priority": 5, "test": True })), True)
def test_dispatch_known_app(): server = APNSProxyServer(dummy_setting) server.create_workers( { "myApp1": { "application_id": "myApp1", "name": "My App1", "sandbox": False, "cert_file": "sample.cert", "key_file": "sample.key" }, "myApp2": { "application_id": "myApp2", "name": "My App2", "sandbox": False, "cert_file": "sample.cert", "key_file": "sample.key" }, }, 1) token = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" eq_( server.dispatch_queue( json.dumps({ "token": token, "appid": "myApp1", "test": True, "aps": { "alert": "This is test", "badge": 1, "sound": "default" }, "expiry": None })), True, "Dispatch should be success") eq_( server.dispatch_queue( json.dumps({ "token": token, "appid": "myApp2", "test": True, "aps": { "alert": "This is test", "badge": 1, "sound": "default", }, "expiry": None })), True, "Dispatch should be success")
def test_dispatch_known_app(): server = APNSProxyServer(dummy_setting) server.create_workers({ "myApp1": { "application_id": "myApp1", "name": "My App1", "sandbox": False, "cert_file": "sample.cert", "key_file": "sample.key" }, "myApp2": { "application_id": "myApp2", "name": "My App2", "sandbox": False, "cert_file": "sample.cert", "key_file": "sample.key" }, }, 1) token = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" eq_(server.dispatch_queue(json.dumps({ "token": token, "appid": "myApp1", "test": True, "aps": { "alert": "This is test", "badge": 1, "sound": "default" }, "expiry": None })), True, "Dispatch should be success") eq_(server.dispatch_queue(json.dumps({ "token": token, "appid": "myApp2", "test": True, "aps": { "alert": "This is test", "badge": 1, "sound": "default", }, "expiry": None })), True, "Dispatch should be success")
def test_dispatch_messages(): server = APNSProxyServer(dummy_setting) server.create_workers( { "myApp2": { "application_id": "myApp2", "name": "My App2", "sandbox": False, "cert_file": "sample.cert", "key_file": "sample.key" }, }, 1) token = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" eq_( server.dispatch_queue( json.dumps({ "token": token, "appid": "myApp2", "aps": { "content_available": True }, "test": True })), True) eq_( server.dispatch_queue( json.dumps({ "token": token, "appid": "myApp2", "aps": { "sound": None, "badge": 99 }, "priority": 5, "test": True })), True)