def test_pfcm_send_one_device(): message_title = "one device" message_body = "{} body of message".format(datetime.datetime.now()) fsmapi = FcmAPI(project_name, private_file) pfcm = Pfcm(fsmapi) for i in range(10): results = pfcm.send_msg(registration_id=registration_id, message_title=message_title, message_body=message_body, with_async=True) for result in results: print(result)
def test_pfcm_send_condition(): message_title = "topic" message_body = "{} body of message".format(datetime.datetime.now()) fsmapi = FcmAPI(project_name, private_file) pfcm = Pfcm(fsmapi) topic = "('test' in topics) && ('test2' in topics)" results = pfcm.send_msg(topic_condition=topic, message_title=message_title, message_body=message_body) for result in results: print(result) assert not "error" in result
def test_pfcm_send_topic(): message_title = "topic" message_body = "{} body of message".format(datetime.datetime.now()) fsmapi = FcmAPI(project_name, private_file) pfcm = Pfcm(fsmapi) topic = "Global_Topic_Dev" results = pfcm.send_msg( topic=topic, message_title=message_title, message_body=message_body) for result in results: print(result)
async def test_pfcm_send_one_device(event_loop): message_title = "one device" message_body = "{} body of message".format(datetime.datetime.now()) fsmapi = FcmAPI(project_name, private_file, event_loop) pfcm = Pfcm(fsmapi) for i in range(10): results = await pfcm.send_msg_async(registration_id=registration_id, message_title=message_title, message_body=message_body) for result in results: print(result)