Remove obsolete function buy_item()

master
Sebastian Pipping il y a 12 ans
Parent 485bcd32a6
révision e26563b946

@ -53,7 +53,7 @@ class BuyCommand(object):
raise ValueError("BuyCommand in illegal state")
def run(self, user_name):
net.buy_item(self._item.id, what_about_it=self._what_to_buy(), user_name=user_name)
raise NotImplementedError('BuyCommand.run(user_name)')
def item_name(self):
return self._item.name

@ -71,16 +71,6 @@ def get_user_name_from_auth_blob(authblob):
return d['username']
def buy_item(item_id, what_about_it, user_name):
require_type(int, item_id)
assert(what_about_it in (ITEM_ONLY, DEPOSIT_ONLY, ITEM_AND_DEPOSIT))
content = _request('buyable/item/' + urllib.quote(str(item_id)),
{'user':user_name, 'deposit':what_about_it, 'amount':1}, method='POST')
if content != 'Created':
raise ValueError('Server says "%s"' % content)
def bulk_buy(buycommands, user_name):
item_ids = tuple(e.item_id() for e in buycommands if e.includes_commodity())
deposit_ids = tuple(e.item_id() for e in buycommands if e.includes_deposit())
@ -131,8 +121,6 @@ if __name__ == '__main__':
user_name = get_user_name_from_auth_blob(os.environ['BARCODE_PLUGIN_TEST_AUTH_BLOB'])
print('User name: ' + user_name)
buy_item(1, True, user_name)
balance = get_balance(user_name)
print('Balance is %f, type is "%s"' % (balance, type(balance).__name__))

Chargement…
Annuler
Enregistrer