def control_editcommishinfo_(request): form = request.web_input(content="", set_commish="", set_trade="", set_request="") set_trade = profile.get_exchange_setting(profile.EXCHANGE_TYPE_TRADE, form.set_trade) set_request = profile.get_exchange_setting(profile.EXCHANGE_TYPE_REQUEST, form.set_request) set_commission = profile.get_exchange_setting(profile.EXCHANGE_TYPE_COMMISSION, form.set_commish) profile.edit_profile_settings(request.userid, set_trade, set_request, set_commission) commishinfo.edit_content(request.userid, form.content) raise HTTPSeeOther(location="/control/editcommissionsettings")
def test_valid_commission_settings(self): user = db_utils.create_user() profile.edit_profile_settings(user, set_trade=profile.EXCHANGE_SETTING_ACCEPTING, set_request=profile.EXCHANGE_SETTING_NOT_ACCEPTING, set_commission=profile.EXCHANGE_SETTING_FULL_QUEUE) test_user_profile = profile.select_profile(user) exchange_settings = profile.exchange_settings_from_settings_string(test_user_profile['settings']) self.assertEqual(exchange_settings[profile.EXCHANGE_TYPE_TRADE], profile.EXCHANGE_SETTING_ACCEPTING) self.assertEqual(exchange_settings[profile.EXCHANGE_TYPE_REQUEST], profile.EXCHANGE_SETTING_NOT_ACCEPTING) self.assertEqual(exchange_settings[profile.EXCHANGE_TYPE_COMMISSION], profile.EXCHANGE_SETTING_FULL_QUEUE)
def create_commish_searchable_user(username, commish_status='o', commishclass='badge', minprice="10.00", maxprice="15.00", currency='', submittime=arrow.get(1)): user = db_utils.create_user(username=username) profile.edit_profile_settings( userid=user, set_commission=profile.get_exchange_setting(profile.EXCHANGE_TYPE_COMMISSION, commish_status) ) commishinfo.create_commission_class(user, commishclass) classid = commishinfo.select_list(user)["class"][0]["classid"] assert classid price = orm.CommishPrice() price.title = "test price" price.classid = classid price.amount_min = commishinfo.parse_currency(minprice) price.amount_max = commishinfo.parse_currency(maxprice) commishinfo.create_price(user, price, currency) db_utils.create_submission(user, unixtime=submittime) return user
def create_commish_searchable_user(username, commish_status='o', commishclass='badge', minprice="10.00", maxprice="15.00", currency='', submittime=arrow.get(1)): user = db_utils.create_user(username=username) profile.edit_profile_settings( userid=user, set_commission=profile.get_exchange_setting(profile.EXCHANGE_TYPE_COMMISSION, commish_status) ) commishinfo.create_commission_class(user, commishclass) classid = commishinfo.select_list(user)["class"][0]["classid"] assert classid price = orm.CommishPrice() price.title = "test price" price.classid = classid price.amount_min = commishinfo.parse_currency(minprice) price.amount_max = commishinfo.parse_currency(maxprice) commishinfo.create_price(user, price, currency) db_utils.create_submission(user, unixtime=submittime) return user