def get_chat_messages_success(auth, pk): url = urls.chatroomdetail_url(pk) res = requests.get(url, auth=auth, verify=False) if res.status_code != 200: print('error!: user {0} cannot get chat room detail'.format(auth[0])) exit(1) else: print('user {0} get messages success'.format(auth[0]))
def get_chat_messages_fail(auth, pk): url = urls.chatroomdetail_url(pk) res = requests.get(url, auth=auth, verify=False) if res.status_code != 403: print('error!: unauthencated user {0} get chat room detail'.format( auth[0])) exit(1) else: print('user {0} fail to get messages success'.format(auth[0]))
def post_chat_messages_fail(auth, pk): url = urls.chatroomdetail_url(pk) data = {'text': 'test message', 'room': pk} res = requests.post(url, data, auth=auth, verify=False) if res.status_code != 403: print('error!: unauthencated user {0} post chat messages'.format( auth[0])) exit(1) else: print('user {0} fail to post messages success'.format(auth[0]))
def post_chat_messages_success(auth, pk): url = urls.chatroomdetail_url(pk) data = {'text': 'test message', 'room': pk} res = requests.post(url, data, auth=auth, verify=False) if res.status_code != 201: print('error!: user {0} cannot post chat message at room#{1}'.format( auth[0], str(pk))) exit(1) else: print('user {0} post messages success'.format(auth[0]))