Esempio n. 1
0
 def setUp(self):
     self.category = Category.create_category(self.GIRS_CATEGORY)
     self.user = User.create_user(self.USERNAME, self.FIRST_NAME, self.LAST_NAME, \
             self.EMAIL, self.PHONE, self.LOCATION)
     self.item1 = Item.create_item(self.user, self.PHYSICS_NAME, \
             self.PHYSICS_DESCRIPTION, self.category, self.PHYSICS_PRICE_1)
     self.item2 = Item.create_item(self.user, self.PHYSICS_NAME, \
             self.PHYSICS_DESCRIPTION, self.category, self.PHYSICS_PRICE_2)
     self.item3 = Item.create_item(self.user, self.VIDEO_NAME, \
             self.VIDEO_DESCRIPTION, self.category, self.VIDEO_PRICE)
     self.reservation1 = Reservation.create_reservation(self.user, \
             self.SEARCH_QUERY1, self.MAX_PRICE)
     self.reservation2 = self.user.add_reservation(self.SEARCH_QUERY2, self.MAX_PRICE)
Esempio n. 2
0
 def setUp(self):
     # create the users
     self.buyer = User.create_user(self.BUYER_USERNAME, \
             self.BUYER_FIRST_NAME, self.BUYER_LAST_NAME, \
             self.BUYER_EMAIL, self.BUYER_CELL_PHONE,
             self.BUYER_LOCATION)
     self.seller = User.create_user(self.SELLER_USERNAME, \
             self.SELLER_FIRST_NAME, self.SELLER_LAST_NAME, \
             self.SELLER_EMAIL, self.SELLER_CELL_PHONE,
             self.SELLER_LOCATION)
     # create the categories
     self.category1 = Category.create_category(self.CATEGORY_1)
     self.category2 = Category.create_category(self.CATEGORY_2)
     # create the items
     self.item1 = Item.create_item(self.seller, self.ITEM_1_NAME, \
             self.ITEM_1_DESCRIPTION, self.category1, self.ITEM_1_PRICE)
     self.item2 = Item.create_item(self.seller, self.ITEM_2_NAME, \
             self.ITEM_2_DESCRIPTION, self.category2, self.ITEM_2_PRICE)
Esempio n. 3
0
    def setUp(self):
        # create the user
        self.user = User.create_user(self.USERNAME, self.FIRST_NAME, \
                self.LAST_NAME, self.EMAIL, self.PHONE, self.LOCATION)

        # create the categories
        self.textbooks = Category.create_category(self.TEXTBOOK_CATEGORY)
        self.videos = Category.create_category(self.VIDEOS_CATEGORY)
        self.girs = Category.create_category(self.GIRS_CATEGORY)

        # create the items
        self.textbook_3091_1 = Item.create_item(self.user, self.TEXTBOOK_NAME, \
                self.TEXTBOOK_DESCRIPTION, self.textbooks, self.TEXTBOOK_PRICE)
        self.textbook_3091_2 = self.user.add_item(self.TEXTBOOK_NAME, \
                self.TEXTBOOK_DESCRIPTION, self.textbooks, self.TEXTBOOK_PRICE)
        self.video_5111 = self.user.add_item(self.VIDEOS_NAME, \
                self.VIDEOS_DESCRIPTION, self.videos, self.VIDEOS_PRICE)
        self.cheat_sheets = self.user.add_item(self.CHEAT_SHEET_NAME, \
                self.CHEAT_SHEET_DESCRIPTION, self.girs, self.CHEAT_SHEET_PRICE)
Esempio n. 4
0
    def test_claim_item_remove(self):
        # create the item
        test_item = Item.create_item(self.seller, self.ITEM_1_NAME, \
                self.ITEM_1_DESCRIPTION, self.category1, self.ITEM_1_PRICE)

        # check that the item is not claimed
        self.assertFalse(test_item.claimed)

        # create the claim
        claim = Claim.create_claim(self.buyer, test_item)

        # check that the item is claimed
        test_item = Item.get_item_by_id(test_item.id)
        self.assertTrue(test_item.claimed)

        # delete the item
        self.seller.remove_item(test_item)

        # check that there is no claim on the item
        self.assertEqual(len(self.buyer.get_claims()), 0)