def get_wall_posts_success(auth, name): url = urls.wall_url(name) res = requests.get(url, auth=auth, verify=False) if res.status_code != 200: print('get {0} wall\'s posts test success - fail'.format(name)) exit(1) else: print('get {0} wall\'s posts test success - success '.format(name))
def get_wall_posts_fail(auth, name): url = urls.wall_url(name) # send without the auth res = requests.get(url, auth=auth, verify=False) if res.status_code != 403: print('get {0} wall\'s posts test fail - fail'.format(name)) exit(1) else: print('get {0} wall\'s posts test fail - success'.format(name))
def post_wall_fail(auth, name, text): url = urls.wall_url(name) data = {'text': text} res = requests.post(url, data, auth=auth, verify=False) if res.status_code != 403: print('error: {0} successfully post on {1}\'s wall'.format( auth[0], name)) exit(1) print('success: {0} cannot post on {1}\'s wall'.format(auth[0], name))
def post_wall_poll_success(auth, name, text): url = urls.wall_url(name) poll_data = '{"question":"what is your favorite food","options":["pizza","cola","orange","mandu","pringles"]}' data = {'text': text, 'poll_data': poll_data} res = requests.post(url, data, auth=auth, verify=False) if res.status_code != 200: print('error: {0} cannot post poll on {1}\'s wall'.format( auth[0], name)) exit(1) print('success: {0} successfully post poll on {1}\'s wall'.format( auth[0], name))