Beispiel #1
0
def test_extract_message(message):
    msg = message.get("valid")
    user_message = message.get("valid_user_message")
    expected = [(user_message[i][0], user_message[i][1])
                for i in range(len(msg))]
    result = [MessageParser().extract_to_message(i) for i in msg]
    assert result == expected
def test_check_authenticate(env_setup, log_cred_test):
    user, passw = MessageParser().parse_login(log_cred_test.get("valid")[0])

    obj = AuthenticationMaster(env_setup.get("db_path"))
    obj.authenticate(user, passw)
    print(user, passw, obj.is_authenticated(user))
    assert obj.is_authenticated(user) is True
Beispiel #3
0
def test_log_invalid(log_message):
    msg = log_message.get("invalid")
    expected = True
    result = [MessageParser().parse_login(i) for i in msg]
    for i in result:
        if i is not None:
            expected = False  # if anyone of the messages is None implies woring message format

    assert expected is True
Beispiel #4
0
def test_message_validator(message):
    msg = message.get("valid")
    expected = [True for _ in msg]
    result = [MessageParser().validate_message(i) for i in msg]
    assert result == expected