Пример #1
0
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"
Пример #2
0
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') == {}
Пример #3
0
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
    }
Пример #4
0
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"
Пример #5
0
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"
Пример #6
0
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"
Пример #7
0
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"]))