class TestGift(unittest.TestCase): giftObj = None; def setUp(self): unittest.TestCase.setUp(self); self.giftObj = Gift("testmember"); def testGetBroughtBy(self): self.assertEqual(self.giftObj.getBroughtBy(), "testmember"); pass
def setUp(self): self.langFilePath = dirname( os.getcwd()) + "\\Resources\\EnglishMessages.txt" self.memberFilePath = dirname( os.getcwd()) + "\\Resources\\testMemberList.txt" self.memberObjs = [ FamilyMember("testMemOne", None, Gift("testMemOne")), FamilyMember("testMemTwo", None, Gift("testMemTwo")) ] self.namesInHat = ["vj", "a"] f = open(self.memberFilePath, "w") f.write("vj\na") f.close() self.logger = Logger() self.viewObj = GiftExchangeCLI(self.logger, self.langFilePath) self.homeScreenController = HomeScreen(self.logger, self.viewObj) self.memberController = MemberController(self.logger, self.viewObj, self.memberFilePath) return
def setUp(self): unittest.TestCase.setUp(self) self.langFilePath = dirname( os.getcwd()) + "\\Resources\\EnglishMessages.txt" self.memberFilePath = dirname( os.getcwd()) + "\\Resources\\testMemberList.txt" self.memberObjs = [ FamilyMember("testMemOne", None, Gift("testMemOne")), FamilyMember("testMemTwo", None, Gift("testMemTwo")) ] self.namesInHat = ["vj", "a"] f = open(self.memberFilePath, "w") f.write("vj\na") f.close() self.logger = Logger() self.viewObj = GiftExchangeCLI(self.logger, self.langFilePath) self.memberController = MemberController(self.logger, self.viewObj, self.memberFilePath) self.magicHatObj = MagicHat( self.logger, self.viewObj, self.memberController.getRegisteredMembers())
def addMemberToDict(self, newMemberName, newMemberPartnersStr = None): ''' Adds the new member to dictionary newMemberName: (str) The name of new member newMemberPartnersStr: (str) The comma separated list of partners ''' newMemberName = newMemberName.replace("\n",""); if(newMemberPartnersStr != None): newMemberPartnersStr = newMemberPartnersStr.replace("\n",""); newMemberPartners = newMemberPartnersStr.split(","); else: newMemberPartners = None; newMemberGift = Gift(newMemberName); newMember = FamilyMember(newMemberName, newMemberPartners, newMemberGift); self.registeredMembers[newMemberName] = newMember; return;
def setUp(self): unittest.TestCase.setUp(self); self.giftObj = Gift("testmember");
def setUp(self): unittest.TestCase.setUp(self) testGift = Gift("memberOne") self.familyMemberObj = FamilyMember("memberOne", ["partner1", "partner2"], testGift)