def notification_forever_bad_tokens(notif_delay=30, run_once=0, token_length=140): """Connects, then repeats every delay interval: 1. send notification with invalid token Repeats forever. """ yield connect() yield hello(None) # register only to retrieve valid endpoint path # (we'll replace valid token with invalid one) reg, endpoint = yield register(random_channel_id()) while True: endpoint = bad_push_endpoint(endpoint, token_length) length, data = random_data(min_length=2048, max_length=4096) response, content = yield send_notification(endpoint, data, headers={"TTL": "60"}) yield counter("notification.throughput.bytes", length) yield counter("notification.sent", 1) yield wait(notif_delay) if run_once: yield disconnect() break
def notification_forever_bad_tokens(notif_delay=30, run_once=0, token_length=140): """Connects, then repeats every delay interval: 1. send notification with invalid token Repeats forever. """ yield connect() yield hello(None) # register only to retrieve valid endpoint path # (we'll replace valid token with invalid one) reg, endpoint = yield register(random_channel_id()) while True: endpoint = bad_push_endpoint(endpoint, token_length) length, data = random_data(min_length=2048, max_length=4096) response, content = yield send_notification(endpoint, data, 60) yield counter("notification.throughput.bytes", length) yield counter("notification.sent", 1) yield wait(notif_delay) if run_once: yield disconnect() break
def notification_forever_bad_endpoints(notif_delay=30, run_once=0): """Connects, repeats every delay interval: 1. send notification with invalid endpoint. Repeats forever. """ yield connect() yield hello(None) while True: endpoint = bad_push_endpoint() length, data = random_data(min_length=2048, max_length=4096) response, content = yield send_notification(endpoint, data, 60) yield counter("notification.throughput.bytes", length) yield counter("notification.sent", 1) yield wait(notif_delay) if run_once: yield disconnect() break
def notification_forever_bad_endpoints(notif_delay=30, run_once=0): """Connects, repeats every delay interval: 1. send notification with invalid endpoint. Repeats forever. """ yield connect() yield hello(None) while True: endpoint = bad_push_endpoint() length, data = random_data(min_length=2048, max_length=4096) response, content = yield send_notification(endpoint, data, headers={"TTL": "60"}) yield counter("notification.throughput.bytes", length) yield counter("notification.sent", 1) yield wait(notif_delay) if run_once: yield disconnect() break
def test_bad_push_endpoint(self): ep = bad_push_endpoint() ok_(ep[:22], '/zoot/allures/cgi-bin/') ok_(len(ep) < 1022)