class TransactionTest(unittest.TestCase): def setUp(self): self.Transaction=Transaction(1) self.transactionItem1 = Item('Sky Kraken Beer, 6-pack', 1, 9.99, 2.00,True) self.transactionItem2 = Item('Pepperidge Farm Goldfish Crackers, 16oz', 2, 3.99, .5, False) self.transactionItem3 = Item('Signature 9 Grain Bread, Loaf', 3, 2.99, 1.2, False) self.transactionItem4 = Item('Ben & Jerrys Ice Cream, Pint', 4, 4.59, 1.3, False) self.Transaction.transactionItemList=[self.transactionItem1, self.transactionItem2, self.transactionItem3, self.transactionItem4] self.user=User('101', 'Mike', 'Gilson', '*****@*****.**', '2065551212') def test_identifyuser(self): self.assertEqual(self.Transaction.identifyUser(self.user), '101') def test_transactionstring(self): self.user.getMemberId() self.assertEquals(self.Transaction.transactionItemList, [self.transactionItem1, self.transactionItem2, self.transactionItem3, self.transactionItem4])
def __str__(self): return User.getMemberId(), self.transactionItemList
def identifyUser(self, User): return User.getMemberId()