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
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
def control_removecommishclass_(request): classid = define.get_int(request.params.get('classid', "")) if not classid: raise WeasylError("classidInvalid") commishinfo.remove_class(request.userid, classid) raise HTTPSeeOther(location="/control/editcommissionsettings")
def control_createcommishclass_(request): form = request.web_input(title="", titlepreset="", price_title="", min_amount="", max_amount="", currency="") title = form.title or form.titlepreset form.currency = form.currency.replace("$", "") classid = commishinfo.create_commission_class(request.userid, title.strip()) # Try to create a base price for it. If we fail, try to clean up the class. try: price = orm.CommishPrice() price.title = form.price_title.strip() price.classid = classid price.amount_min = commishinfo.parse_currency(form.min_amount) price.amount_max = commishinfo.parse_currency(form.max_amount) commishinfo.create_price(request.userid, price, currency=form.currency) except WeasylError as we: commishinfo.remove_class(request.userid, classid) raise we raise HTTPSeeOther(location="/control/editcommissionsettings")
def control_removecommishclass_(request): form = request.web_input(classid="") commishinfo.remove_class(request.userid, form.classid) raise HTTPSeeOther(location="/control/editcommissionprices")
def control_removecommishclass_(request): form = request.web_input(classid="") commishinfo.remove_class(request.userid, form.classid) raise HTTPSeeOther(location="/control/editcommissionsettings")
def POST(self): form = web.input(classid="") commishinfo.remove_class(self.user_id, form.classid) raise web.seeother("/control/editcommissionprices")