def test_standup_start_invalidID(register): auth_logout(register[0]['token']) auth_logout(register[1]['token']) login_return = auth_login("*****@*****.**", "myunsw") login_return2 = auth_login("*****@*****.**", "mygmail") channel = channels_create(login_return['token'], "Test Channel 0", True) u_id = login_return['u_id'] token = login_return['token'] with pytest.raises(ValueError): standup_start(token, 1000, 10), "Channel (based on ID) does not exist"
def standup_sendsuccess(register): auth_logout(register[0]['token']) auth_logout(register[1]['token']) login_return = auth_login("*****@*****.**", "myunsw") login_return2 = auth_login("*****@*****.**", "mygmail") channel = channels_create(login_return['token'], "Test Channel 0", True) u_id = login_return['u_id'] token = login_return['token'] standup_start(token, channel['channel_id'], 20) assert standup_send(token, channel['channel_id'], 'success') == {}
def standup_active_success(register): auth_logout(register[0]['token']) auth_logout(register[1]['token']) login_return = auth_login("*****@*****.**", "myunsw") login_return2 = auth_login("*****@*****.**", "mygmail") channel = channels_create(login_return['token'], "Test Channel 0", True) u_id = login_return['u_id'] token = login_return['token'] assert standup_active(token, channel['channel_id']) == { is_active: False, time_finish: None }
def standup_send_notmember(register): auth_logout(register[0]['token']) auth_logout(register[1]['token']) login_return = auth_login("*****@*****.**", "myunsw") login_return2 = auth_login("*****@*****.**", "mygmail") channel = channels_create(login_return['token'], "Test Channel 0", True) u_id = login_return['u_id'] token = login_return['token'] token1 = login_return2['token'] standup_start(token, 1, 20) with pytest.raises(ValueError): standup_send(token1, 1, 'notmember'), "not a member of the channel"
def standup_send_unactive(register): auth_logout(register[0]['token']) auth_logout(register[1]['token']) login_return = auth_login("*****@*****.**", "myunsw") login_return2 = auth_login("*****@*****.**", "mygmail") channel = channels_create(login_return['token'], "Test Channel 0", True) u_id = login_return['u_id'] token = login_return['token'] with pytest.raises(ValueError): standup_send( token, 1, 'unactive' ), "An active standup is not currently running in this channel"
def standup_sendLongmsg(register): auth_logout(register[0]['token']) auth_logout(register[1]['token']) login_return = auth_login("*****@*****.**", "myunsw") login_return2 = auth_login("*****@*****.**", "mygmail") channel = channels_create(login_return['token'], "Test Channel 0", True) u_id = login_return['u_id'] token = login_return['token'] message = "a" * 1001 standup_start(token, channel['channel_id'], 20) with pytest.raises(ValueError): standup_send(token, channel['channel_id'], message), "Message is more than 1000"
def handle_auth_logout(): """ HTTP Route: /auth/logout HTTP Method: POST Params: (token) Returns JSON: { } """ request_data = request.get_json() printColour(" ➤ Logged out: {}".format(request_data["token"]), colour="blue") return jsonify(auth_logout(request_data["token"]))