def testCreateLyonnesseAdvantage(self): emailAddr='*****@*****.**' testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr)) testContent = lyonnesseadvantage.get_lyonnesseadvantage(lyonnesseadvantage.LYONESSEADVANTAGE_ABSURD, owner=testEntity) result = lyonnesseadvantage.get_lyonnesseadvantage(lyonnesseadvantage.LYONESSEADVANTAGE_ABSURD, testEntity) self.assertIsNotNone(result) self.assertEqual( result, testContent) self.assertEqual( result.value, lyonnesseadvantage.LYONESSEADVANTAGE_ABSURD) self.assertEqual( result.valName, 'Absurd')
def testCloneLyonnesseRoundEffect(self): eAddrs=['*****@*****.**', '*****@*****.**'] testEntity = hydrauser.create_hydra_user(users.User(email=eAddrs[0])) origPub = hydrauser.create_hydra_user(users.User(email=eAddrs[1])) testAdv = lyonnesseadvantage.get_lyonnesseadvantage(lyonnesseadvantage.LYONESSEADVANTAGE_ABSURD, origPub) testyAction = lyonnesseroundaction.LyonnesseRoundAction( moveDestination = [1.0,2.0,3.0], action = lyonnesseroundaction.LYONNESSEROUNDACTION_ATTACK, strengthEffort = True, agilityEffort = False, speedEffort = True, poised = True, repeat = False, advantage = testAdv, parent = origPub ) testyAction.put() testContent = lyonnesseroundeffect.LyonnesseRoundEffect(roundAction = testyAction, wounds=0, fatigue=1, moveDestination=[1.0,2.0,3.0], parent=origPub) testContent.put() result = testContent.clone( testEntity) self.assertIsNotNone(result) self.assertIsInstance( result, lyonnesseroundeffect.LyonnesseRoundEffect) self.assertEqual( result.roundAction, testyAction) self.assertEqual( result.wounds, 0) self.assertEqual( result.fatigue, 1) self.assertEqual( result, testContent) # test __eq__
def testInsertLyonnesseRoundAction(self): emailAddr='*****@*****.**' testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr)) testAdv = lyonnesseadvantage.get_lyonnesseadvantage(lyonnesseadvantage.LYONESSEADVANTAGE_ABSURD, testEntity) testContent = lyonnesseroundaction.LyonnesseRoundAction( moveDestination = [1.0,2.0,3.0], action = lyonnesseroundaction.LYONNESSEROUNDACTION_ATTACK, strengthEffort = True, agilityEffort = False, speedEffort = True, poised = True, repeat = False, advantage = testAdv, parent = testEntity ) testContent.put() result = lyonnesseroundaction.LyonnesseRoundAction.all().get() self.assertIsNotNone(result) self.assertIsInstance( result, lyonnesseroundaction.LyonnesseRoundAction) self.assertEqual( result.action, lyonnesseroundaction.LYONNESSEROUNDACTION_ATTACK) self.assertEqual( result.strengthEffort, True) self.assertEqual( result.agilityEffort, False) self.assertEqual( result.speedEffort, True) self.assertEqual( result.poised, True) self.assertEqual( result.repeat, False) self.assertEqual( result.advantage, testAdv) self.assertEqual( result, testContent) # test __eq__
def testEnumerateLyonnesseAdvantage(self): emailAddr='*****@*****.**' testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr)) result = lyonnesseadvantage.get_lyonnesseadvantage(lyonnesseadvantage.LYONESSEADVANTAGE_ABSURD, owner=testEntity) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnesseadvantage.LYONESSEADVANTAGE_ABSURD) self.assertEqual( result.valName, 'Absurd') result = lyonnesseadvantage.get_lyonnesseadvantage(lyonnesseadvantage.LYONESSEADVANTAGE_HARD) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnesseadvantage.LYONESSEADVANTAGE_HARD) self.assertEqual( result.valName, 'Hard') result = lyonnesseadvantage.get_lyonnesseadvantage(lyonnesseadvantage.LYONESSEADVANTAGE_CHALLENGING) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnesseadvantage.LYONESSEADVANTAGE_CHALLENGING) self.assertEqual( result.valName, 'Challenging') result = lyonnesseadvantage.get_lyonnesseadvantage(lyonnesseadvantage.LYONESSEADVANTAGE_NORMAL) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnesseadvantage.LYONESSEADVANTAGE_NORMAL) self.assertEqual( result.valName, 'Normal') result = lyonnesseadvantage.get_lyonnesseadvantage(lyonnesseadvantage.LYONESSEADVANTAGE_EASY) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnesseadvantage.LYONESSEADVANTAGE_EASY) self.assertEqual( result.valName, 'Easy') result = lyonnesseadvantage.get_lyonnesseadvantage(lyonnesseadvantage.LYONESSEADVANTAGE_ROUTINE) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnesseadvantage.LYONESSEADVANTAGE_ROUTINE) self.assertEqual( result.valName, 'Routine') result = lyonnesseadvantage.get_lyonnesseadvantage(lyonnesseadvantage.LYONESSEADVANTAGE_TRIVIAL) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnesseadvantage.LYONESSEADVANTAGE_TRIVIAL) self.assertEqual( result.valName, 'Trivial')