Exemplo n.º 1
0
def test_2_standups(register_login):
    token = register_login['token']
    channel_id = register_login['channel_id']
    # Start the first standup
    time_finish = standup_start(token, channel_id, 1)['time_finish']
    result = standup_active(token, channel_id)

    assert result == {
        'is_active': True,
        'time_finish': time_finish
    }
    # Ensure the first standup finishes
    sleep(2)
    result = standup_active(token, channel_id)
    assert result == {
        'is_active': False,
        'time_finish': None
    }
    # Start the second standup
    time_finish = standup_start(token, channel_id, 1)['time_finish']
    result = standup_active(token, channel_id)

    assert result == {
        'is_active': True,
        'time_finish': time_finish
    }
    # Ensure the second standup finishes
    sleep(2)
    result = standup_active(token, channel_id)
    assert result == {
        'is_active': False,
        'time_finish': None
    }
Exemplo n.º 2
0
def test_valid_member(register_2_users_channel):
    channel = register_2_users_channel
    standup_length = 1
    standup_start(channel['member']['token'], channel['c_id'], standup_length)

    standup = standup_active(channel['member']['token'], channel['c_id'])
    assert standup['is_active']
Exemplo n.º 3
0
def test_invalid_active_standup(register_2_users_channel):
    channel = register_2_users_channel
    standup_length = 1
    # Start the first standup
    time_finish = standup_start(channel['member']['token'], channel['c_id'],
                                standup_length)['time_finish']

    result = standup_active(channel['member']['token'], channel['c_id'])
    assert result == {'is_active': True, 'time_finish': time_finish}
    # Ensure that another standup cannot be started
    with pytest.raises(InputError):
        standup_start(channel['owner']['token'], channel['c_id'],
                      standup_length)
Exemplo n.º 4
0
def standup_start_flask():
    payload = request.get_json()

    token = payload['token']
    channel_id = payload['channel_id']
    length = payload['length']

    return dumps(s.standup_start(token, channel_id, length))
Exemplo n.º 5
0
def standup(channel_with_user):
    owner = channel_with_user
    standup_length = 1
    time = standup_start(owner['token'], owner['c_id'], standup_length)
    active = standup_active(owner['token'], owner['c_id'])

    return {
        'is_active': active,
        'time_finish': time,
    }
Exemplo n.º 6
0
def test_invalid_channel(register_2_users_channel):
    channel = register_2_users_channel
    invalid_c_id = -1
    standup_length = 1
    with pytest.raises(InputError):
        standup_start(channel['owner']['token'], invalid_c_id, standup_length)
Exemplo n.º 7
0
def test_invalid_token(register_2_users_channel):
    channel = register_2_users_channel
    invalid_token = token_hash(-1)
    standup_length = 1
    with pytest.raises(AccessError):
        standup_start(invalid_token, channel['c_id'], standup_length)