def test_standup_active_invalid_channel():
    clear_v1()

    auth_user_1_data = auth_register_v2("*****@*****.**", "123456", "Andy",
                                        "Dandy")
    auth_user_1_token = auth_user_1_data["token"]

    with pytest.raises(InputError):
        standup_active_v1(auth_user_1_token, 99999)
Пример #2
0
def test_invalid_token(reg_user, crt_channel):
    clear_v2()

    token = reg_user(0)['token']

    channel_id = crt_channel(token)['channel_id']

    standup_length = 1
    standup_start_v1(token, channel_id, standup_length)

    with pytest.raises(AccessError):
        standup_active_v1("Invalid token", channel_id)
Пример #3
0
def test_standup_start_currently_running_standup(reg_user, basic_channel_name):
    clear_v2()
    token_1 = reg_user(0)['token']
    channel_name = basic_channel_name
    channel_id = channels_create_v2(token_1, channel_name, True)['channel_id']
    standup_length = 10
    
    is_active = standup_active_v1(token_1, channel_id)['is_active']
    assert is_active == False
    
    standup_start_v1(token_1, channel_id, standup_length)
    
    is_active = standup_active_v1(token_1, channel_id)['is_active']
    assert is_active == True #now that standup is running this should change to True 
Пример #4
0
def test_standup_start_v1_standup_not_started_in_multiple_channels_with_same_user(reg_user, basic_channel_name):
    clear_v2()
    token_1 = reg_user(0)['token']
    channel_name = basic_channel_name
    channel_id_1 = channels_create_v2(token_1, channel_name, True)['channel_id']
    channel_id_2 = channels_create_v2(token_1, 'nice channel', True)['channel_id'] #second channel
    standup_length = 1

    standup_start_v1(token_1, channel_id_1, standup_length)
    
    is_active_channel_1 = standup_active_v1(token_1, channel_id_1)['is_active']
    assert is_active_channel_1 == True 
    
    is_active_channel_2 = standup_active_v1(token_1, channel_id_2)['is_active']
    assert is_active_channel_2 == False
Пример #5
0
def test_standup_start_user_that_joined_channel_can_standup(reg_user, basic_channel_name):
    clear_v2()
    token_1 = reg_user(0)['token']
    joined_user_token = reg_user(1)['token']
    channel_name = basic_channel_name
    channel_id = channels_create_v2(token_1, channel_name, True)['channel_id']
    standup_length = 10
    
    channel_join_v2(joined_user_token, channel_id)
    is_active = standup_active_v1(joined_user_token, channel_id)['is_active']
    assert is_active == False
    
    standup_start_v1(joined_user_token, channel_id, standup_length)
    
    is_active = standup_active_v1(joined_user_token, channel_id)['is_active']
    assert is_active == True #now that standup is running this should change to True 
Пример #6
0
def standup_active():
    token = request.args.get('token')
    channel_id = request.args.get('channel_id')

    standup_active = standup_active_v1(token, channel_id)

    return dumps(standup_active)
Пример #7
0
def test_standup_start_v1_non_clash_between_channels_with_standup(reg_user, basic_channel_name):
    clear_v2()
    token_1 = reg_user(0)['token']
    token_2 = reg_user(1)['token']
    channel_name = basic_channel_name
    channel_id_1 = channels_create_v2(token_1, channel_name, True)['channel_id']
    channel_id_2 = channels_create_v2(token_2, 'nice channel', True)['channel_id'] #second channel
    standup_length = 5
    
    standup_start_v1(token_1, channel_id_1, standup_length)
    standup_start_v1(token_2, channel_id_2, standup_length)
    
    is_active_channel_1 = standup_active_v1(token_1, channel_id_1)['is_active']
    assert is_active_channel_1 == True 
    
    is_active_channel_2 = standup_active_v1(token_2, channel_id_2)['is_active']
    assert is_active_channel_2 == True 
Пример #8
0
def test_standup_start(reg_user, crt_channel, standup_message):
    clear_v2()
    token = reg_user(0)['token']
    channel_id = crt_channel(token)['channel_id']

    standup_message(token, channel_id)

    assert standup_active_v1(token, channel_id)['is_active']
Пример #9
0
def test_no_active_standup(reg_user, crt_channel):
    clear_v2()

    token = reg_user(0)['token']

    channel_id = crt_channel(token)['channel_id']

    standup_info = standup_active_v1(token, channel_id)

    assert not standup_info['is_active']
    assert standup_info['time_finish'] == None
def test_standup_active_v1():
    clear_v1()

    auth_user_1_data = auth_register_v2("*****@*****.**", "123456", "Andy",
                                        "Dandy")
    auth_user_1_token = auth_user_1_data["token"]

    channel_id_1 = channels_create_v2(auth_user_1_token, "Andys channel",
                                      True)["channel_id"]

    standup_status = standup_active_v1(auth_user_1_token, channel_id_1)

    assert standup_status["is_active"] == False
    assert standup_status["time_finish"] == None

    time_finish = standup_start_v1(auth_user_1_token, channel_id_1,
                                   10)["time_finish"]
    standup_status = standup_active_v1(auth_user_1_token, channel_id_1)

    assert standup_status["is_active"] == True
    assert standup_status["time_finish"] == time_finish
Пример #11
0
def test_standup_active_v1(user_setup, channel_setup, standup_setup):

    # Test 1:
    # invalid token
    with pytest.raises(AccessError):
        standup_active_v1(make_token(414345), 0)
    # "Invalid token"

    # Test 2:
    # invalid channel id
    with pytest.raises(InputError):
        standup_active_v1(make_token(2), 414345)
    # "Invalid channel"

    # Test 3:
    # no active standup
    assert standup_active_v1(make_token(0), 0) == {
        "is_active": False,
        "time_finish": None
    }

    # Test 4:
    # active standup
    dateTimeObj = datetime.now()
    timeStampStr = (dateTimeObj +
                    timedelta(seconds=1)).strftime("%d-%b-%Y (%H:%M)")
    assert standup_active_v1(make_token(3), 2) == {
        "is_active": True,
        "time_finish": timeStampStr
    }
Пример #12
0
def test_active_standup(reg_user, crt_channel):
    clear_v2()

    token = reg_user(0)['token']

    channel_id = crt_channel(token)['channel_id']

    standup_length = 5
    finish_time = standup_start_v1(token, channel_id,
                                   standup_length)['time_finish']

    standup_info = standup_active_v1(token, channel_id)

    assert standup_info['is_active']
    assert standup_info['time_finish'] == finish_time
Пример #13
0
def standup_active():
    parameters = request.args
    token = parameters['token']
    channel_id = int(parameters['channel_id'])
    output = standup_active_v1(token, channel_id)
    return dumps(output)