def test_remove_inv_item_delete_stack(self): add_qty = 10 remove_qty = 10 add_inv_item(self.user, self.ITEM_ID, add_qty) remove_inv_item(self.user, self.ITEM_ID, remove_qty) self.assertFalse( self.user.inventory.filter(item_id=self.ITEM_ID).exists())
def test_add_inv_item_exists(self): add_qty = 10 add_inv_item(self.user, self.ITEM_ID, add_qty) add_inv_item(self.user, self.ITEM_ID, add_qty) self.assertTrue( self.user.inventory.filter(item_id=self.ITEM_ID, qty=add_qty * 2).exists())
def test_remove_inv_item_exists(self): add_qty = 10 remove_qty = 5 add_inv_item(self.user, self.ITEM_ID, add_qty) remove_inv_item(self.user, self.ITEM_ID, remove_qty) self.assertTrue( self.user.inventory.filter(item_id=self.ITEM_ID, qty=add_qty - remove_qty).exists())
def test_setup_already_setup(self): self.s_module.is_setup = True costs = ModuleSetupCost.objects.filter( module_item_id=self.s_module.item_id) for cost in costs: add_inv_item(self.user, cost.item_id, cost.qty) self.s_module.setup() for cost in costs: self.assertTrue( self.user.inventory.filter(item_id=cost.item_id, qty=cost.qty).exists()) self.assertTrue(self.s_module.is_setup)
def user_extra_data(self): add_inv_item(self.user, self.BADGE_ID) self.user.profile.page_skin_id = self.SKIN_ID self.user.profile.page_color_id = self.COLOR_ID self.user.profile.page_column_color_id = 0 self.user.profile.save() about_me = AboutMe(user=self.user) i = 0 for question_id, answers in self.STATEMENTS.items(): setattr(about_me, "question_%s_id" % i, question_id) setattr(about_me, "answer_%s_id" % i, answers[0]) i += 1 if i == 6: break about_me.save()
def has_masterpiece_blueprint(self): add_inv_item(self.user, self.MASTERPIECE_BLUEPRINT_ID)
def has_item_blueprint(self): add_inv_item(self.user, self.BLUEPRINT_ID)
def has_masterpiece(self): add_inv_item(self.user, self.MASTERPIECE_ITEM_ID)
def has_module(self): add_inv_item(self.user, self.MODULE_ITEM_ID)
def has_execution_cost(self): add_inv_item(self.other_user, self.EXECUTION_COST.item_id, self.EXECUTION_COST.qty)
def has_setup_cost(self): add_inv_item(self.user, self.SETUP_COST.item_id, self.SETUP_COST.qty)
def has_loop(self): add_inv_item(self.user, self.LOOP_ID)
def test_remove_inv_item_not_enough_items(self): add_qty = 5 remove_qty = 10 add_inv_item(self.user, self.ITEM_ID, add_qty) with self.assertRaises(RuntimeError): remove_inv_item(self.user, self.ITEM_ID, remove_qty)
def has_stickers(self): add_inv_item(self.user, self.STICKER_ID) add_inv_item(self.user, self.BACKGROUND_ID)
def has_masterpiece_requirement(self): add_inv_item(self.user, self.MASTERPIECE_REQUIREMENT_ID)
def has_requirement(self): add_inv_item(self.user, self.REQUIREMENT_ID)
def has_harvestable_module_stack(self): add_inv_item(self.user, self.HARVESTABLE_MODULE_ID)