Пример #1
0
def test_commish_search_invalid():
    # searcher
    u1 = db_utils.create_user(username="******")

    # user not open for commissions, but with submissions and commish classes defined
    create_commish_searchable_user("u2", commish_status='c')

    # user open for commission but without any commish classes
    u3 = create_commish_searchable_user("u3")
    classid = commishinfo.select_list(u3)["class"][0]["classid"]
    commishinfo.remove_class(u3, classid)

    # user meets all requirements, but is suspended
    u4 = create_commish_searchable_user("u4")
    db_utils.create_suspenduser(u4, "", d.get_time() + 604800)

    # user meets all requirements, but is banned
    u5 = create_commish_searchable_user("u5")
    db_utils.create_banuser(u5, "")

    # user meets all requirements, but is ignored by searching user
    u6 = create_commish_searchable_user("u6")
    db_utils.create_ignoreuser(u1, u6)

    results = commishinfo.select_commissionable(userid=u1,
                                                limit=10,
                                                offset=0,
                                                q="",
                                                commishclass="",
                                                min_price=None,
                                                max_price=None,
                                                currency='')
    assert not results
Пример #2
0
def test_commish_search_invalid():
    # searcher
    u1 = db_utils.create_user(username="******")

    # user not open for commissions, but with submissions and commish classes defined
    create_commish_searchable_user("u2", commish_status='c')

    # user open for commission but without any commish classes
    u3 = create_commish_searchable_user("u3")
    classid = commishinfo.select_list(u3)["class"][0]["classid"]
    commishinfo.remove_class(u3, classid)

    # user meets all requirements, but is suspended
    u4 = create_commish_searchable_user("u4")
    db_utils.create_suspenduser(u4, "", arrow.now() + datetime.timedelta(days=7))

    # user meets all requirements, but is banned
    u5 = create_commish_searchable_user("u5")
    db_utils.create_banuser(u5, "")

    # user meets all requirements, but is ignored by searching user
    u6 = create_commish_searchable_user("u6")
    db_utils.create_ignoreuser(u1, u6)

    results = commishinfo.select_commissionable(userid=u1,
                                                limit=10,
                                                offset=0,
                                                q="",
                                                commishclass="",
                                                min_price=None,
                                                max_price=None,
                                                currency='')
    assert not results
Пример #3
0
def test_login_fails_if_user_is_suspended():
    user_id = db_utils.create_user(password=raw_password, username=user_name)
    release_date = d.get_time() + 60
    db_utils.create_suspenduser(userid=user_id,
                                reason="Testing",
                                release=release_date)
    result = login.authenticate_bcrypt(username=user_name,
                                       password=raw_password,
                                       request=None)
    assert result == (user_id, 'suspended')
Пример #4
0
def test_login_succeeds_if_suspension_duration_has_expired():
    user_id = db_utils.create_user(password=raw_password, username=user_name)
    release_date = d.convert_unixdate(31, 12, 2015)
    db_utils.create_suspenduser(userid=user_id,
                                reason="Testing",
                                release=release_date)
    result = login.authenticate_bcrypt(username=user_name,
                                       password=raw_password,
                                       request=None)
    assert result == (user_id, None)