def test_form_invalid(self): self.request_login(self.account.email) self.hero.cards.add_card(self.card) heroes_logic.save_hero(self.hero) self.check_ajax_error(self.post_ajax_json(logic.use_card_url(self.card.uid), self.post_data(self.card.uid, place_id=666, building_id=666, person_id=666)), 'form_errors')
def test_success(self): self.request_login(self.account.email) self.hero.cards.add_card(self.card) heroes_logic.save_hero(self.hero) response = self.post_ajax_json(logic.use_card_url(self.card.uid), self.post_data(self.card.uid)) task = PostponedTaskPrototype._db_get_object(0) self.check_ajax_processing(response, task.status_url) task.remove()
def test_success(self): self.request_login(self.account.email) self.hero.cards.add_card(self.card) self.hero.save() response = self.post_ajax_json(logic.use_card_url(self.card.uid), self.post_data(self.card.uid)) task = common_postponed_tasks.PostponedTaskPrototype._db_get_object(0) self.check_ajax_processing(response, task.status_url) task.remove()
def test_no_cards(self): self.request_login(self.account.email) self.check_ajax_error(self.post_ajax_json(logic.use_card_url(666)), 'card.wrong_value')
def test_unlogined(self): self.check_ajax_error(self.post_ajax_json(logic.use_card_url(666), self.post_data(666)), 'common.login_required')
def use_card_url(card_uid): return jinja2.Markup(logic.use_card_url(card_uid))
def test_form_invalid(self): self.request_login(self.account.email) self.hero.cards.add_card(self.card) self.hero.save() self.check_ajax_error(self.post_ajax_json(logic.use_card_url(self.card.uid), self.post_data(self.card.uid, place_id=666, building_id=666, person_id=666)), 'form_errors')