Example #1
0
def test_remove_user():
    user = users.add_user('test_remove_user_user',
                          'test_remove_user_user_password')
    assert user is not None
    assert user.username == 'test_remove_user_user'
    assert user.check_password('test_remove_user_user_password') is True

    users.remove_user('test_remove_user_user')
    assert users.get_user('test_remove_user_user') is None
Example #2
0
def test_remove_user():
    user = users.add_user(
        'test_remove_user_user',
        'test_remove_user_user_password'
    )
    assert user is not None
    assert user.username == 'test_remove_user_user'
    assert user.check_password('test_remove_user_user_password') is True

    users.remove_user('test_remove_user_user')
    assert users.get_user('test_remove_user_user') is None
Example #3
0
def test_load_users():
    with temp_file('testusers.dat'):
        with patch('manufactorum.users.USERS_FILE', 'testusers.dat'):
            assert users.load_users() == []

            users.add_user('test_load_users_user',
                           'test_load_users_user_password')

            assert len(users.load_users()) == 1
            assert users.user_exists('test_load_users_user') is True
            assert users.user_exists('Someone') is False

            user = users.get_user('test_load_users_user')
            assert user is not None
            assert user.username == 'test_load_users_user'
            assert user.check_password('test_load_users_user_password') is True

            users.remove_user('test_load_users_user')
Example #4
0
def test_load_users():
    with temp_file('testusers.dat'):
        with patch('manufactorum.users.USERS_FILE', 'testusers.dat'):
            assert users.load_users() == []

            users.add_user(
                'test_load_users_user',
                'test_load_users_user_password'
            )

            assert len(users.load_users()) == 1
            assert users.user_exists('test_load_users_user') is True
            assert users.user_exists('Someone') is False

            user = users.get_user('test_load_users_user')
            assert user is not None
            assert user.username == 'test_load_users_user'
            assert user.check_password('test_load_users_user_password') is True

            users.remove_user('test_load_users_user')