コード例 #1
0
 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())
コード例 #2
0
 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())
コード例 #3
0
 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())
コード例 #4
0
 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)
コード例 #5
0
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()
コード例 #6
0
def has_masterpiece_blueprint(self):
    add_inv_item(self.user, self.MASTERPIECE_BLUEPRINT_ID)
コード例 #7
0
def has_item_blueprint(self):
    add_inv_item(self.user, self.BLUEPRINT_ID)
コード例 #8
0
def has_masterpiece(self):
    add_inv_item(self.user, self.MASTERPIECE_ITEM_ID)
コード例 #9
0
def has_module(self):
    add_inv_item(self.user, self.MODULE_ITEM_ID)
コード例 #10
0
def has_execution_cost(self):
    add_inv_item(self.other_user, self.EXECUTION_COST.item_id,
                 self.EXECUTION_COST.qty)
コード例 #11
0
def has_setup_cost(self):
    add_inv_item(self.user, self.SETUP_COST.item_id, self.SETUP_COST.qty)
コード例 #12
0
def has_loop(self):
    add_inv_item(self.user, self.LOOP_ID)
コード例 #13
0
 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)
コード例 #14
0
def has_stickers(self):
    add_inv_item(self.user, self.STICKER_ID)
    add_inv_item(self.user, self.BACKGROUND_ID)
コード例 #15
0
def has_masterpiece_requirement(self):
    add_inv_item(self.user, self.MASTERPIECE_REQUIREMENT_ID)
コード例 #16
0
def has_requirement(self):
    add_inv_item(self.user, self.REQUIREMENT_ID)
コード例 #17
0
def has_harvestable_module_stack(self):
    add_inv_item(self.user, self.HARVESTABLE_MODULE_ID)