def testCloneLyonnesseWeapon(self): eAddrs=['*****@*****.**', '*****@*****.**'] testEntity = hydrauser.create_hydra_user(users.User(email=eAddrs[0])) origPub = hydrauser.create_hydra_user(users.User(email=eAddrs[1])) testWS = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_AVERAGE, origPub) testPS = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_CHARACTERS) testName = 'Battle Axe' testContent = hydracontent.create_hydra_content(lyonnesseweapon.LyonnesseWeapon, owner=origPub, originalPublisher=origPub, weaponSpeed=testWS, poisedSpeed=testPS, length=8, instanceName=testName ) testContent.put() result = testContent.clone( testEntity) self.assertIsNotNone(result) self.assertIsInstance( result, lyonnesseweapon.LyonnesseWeapon) self.assertEqual( result.weaponSpeed, testWS) self.assertEqual( result.poisedSpeed, testPS) self.assertEqual( result.instanceName, testName) self.assertEqual( result.length, 8)
def testInsertLyonnesseWeapon(self): emailAddr='*****@*****.**' testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr)) testWS = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_AVERAGE, testEntity) testPS = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_CHARACTERS) testName = 'Battle Axe' testContent = hydracontent.create_hydra_content(lyonnesseweapon.LyonnesseWeapon, owner=testEntity, weaponSpeed=testWS, poisedSpeed=testPS, length=8, instanceName=testName ) testContent.put() result = hydracontent.load_hydra_content( testEntity) self.assertIsNotNone(result) result = db.get( testContent.key()) self.assertIsNotNone(result) self.assertIsInstance( result, lyonnesseweapon.LyonnesseWeapon) self.assertEqual( result.weaponSpeed, testWS) self.assertEqual( result.poisedSpeed, testPS) self.assertEqual( result.instanceName, testName) self.assertEqual( result.length, 8) self.assertEqual( result, testContent) # test __eq__
def testCloneLyonnessePC(self): eAddrs=['*****@*****.**', '*****@*****.**'] testEntity = hydrauser.create_hydra_user(users.User(email=eAddrs[0])) origPub = hydrauser.create_hydra_user(users.User(email=eAddrs[1])) strength = lyonnessemass.get_lyonnessemass(lyonnessemass.LYONNESSEMASS_LARGE, owner=origPub) ag = lyonnessespeed.get_lyonnessespeed( lyonnessespeed.LYONNESSESPEED_CREEPING, origPub) sp = lyonnessespeed.get_lyonnessespeed( lyonnessespeed.LYONNESSESPEED_DELIBERATE) dur = lyonnessemass.get_lyonnessemass(lyonnessemass.LYONNESSEMASS_LARGE) testName = "Instance Name" testDesc = "I want to ride my bicycle" testLE = hydracontent.create_hydra_content(lyonnesselogentry.LyonnesseLogEntry, instanceName = testName, description = testDesc, owner = testEntity ) testLE.put() testHistory = hydracontent.create_hydra_content(lyonnessecreaturehistory.LyonnesseCreatureHistory, owner = testEntity, logEntries = [testLE.key()] ) testHistory.put() testContent = hydracontent.create_hydra_content( lyonnessepc.LyonnessePC, owner=origPub, originalPublisher=origPub, strength = strength, agility=ag, speed=sp, durability=dur, wounds = 1, fatigue = 2, maxhits = 12, history = testHistory, instanceName = testName ) testContent.put() result = testContent.clone( testEntity) self.assertIsNot( result, testContent) self.assertEqual(result.owner, testEntity) self.assertEqual(result.originalPublisher, origPub) self.assertEqual(result.instanceName, testName) self.assertIsInstance( result, lyonnessepc.LyonnessePC) self.assertEqual( result.strength, strength) self.assertEqual( result.agility, ag) self.assertEqual( result.speed, sp) self.assertEqual( result.durability, dur) self.assertEqual( result.maxhits, 12) self.assertEqual( result.wounds, 1) self.assertEqual( result.fatigue, 2) self.assertEqual( result.history, testHistory)
def testCreateLyonnesseSpeed(self): emailAddr='*****@*****.**' testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr)) testContent = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_STATIONARY, owner=testEntity ) result = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_STATIONARY) self.assertIsNotNone(result) self.assertEqual( result, testContent) self.assertEqual( result.value, lyonnessespeed.LYONNESSESPEED_STATIONARY) self.assertEqual( result.valName, 'Stationary')
def testCloneLyonnesseCreature(self): eAddrs=['*****@*****.**', '*****@*****.**'] testEntity = hydrauser.create_hydra_user(users.User(email=eAddrs[0])) origPub = hydrauser.create_hydra_user(users.User(email=eAddrs[1])) strength = lyonnessemass.get_lyonnessemass(lyonnessemass.LYONNESSEMASS_LARGE, owner=origPub) ag = lyonnessespeed.get_lyonnessespeed( lyonnessespeed.LYONNESSESPEED_CREEPING, origPub) sp = lyonnessespeed.get_lyonnessespeed( lyonnessespeed.LYONNESSESPEED_DELIBERATE) dur = lyonnessemass.get_lyonnessemass(lyonnessemass.LYONNESSEMASS_LARGE, origPub) testContent = hydracontent.create_hydra_content(lyonnessecreature.LyonnesseCreature, owner = origPub, originalPublisher = origPub, strength = strength, agility=ag, speed=sp, durability=dur, wounds = 1, fatigue = 2, maxhits = 12 ) testContent.put() result = testContent.clone( testEntity) self.assertIsNot( result, testContent) self.assertEqual(result.owner, testEntity) self.assertEqual(result.originalPublisher, origPub) self.assertIsInstance( result, lyonnessecreature.LyonnesseCreature) self.assertEqual( result.strength, strength) self.assertEqual( result.agility, ag) self.assertEqual( result.speed, sp) self.assertEqual( result.durability, dur) self.assertEqual( result.maxhits, 12) self.assertEqual( result.wounds, 1) self.assertEqual( result.fatigue, 2)
def testInsertLyonnesseCreature(self): emailAddr='*****@*****.**' testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr)) strength = lyonnessemass.get_lyonnessemass(lyonnessemass.LYONNESSEMASS_LARGE, owner=testEntity) ag = lyonnessespeed.get_lyonnessespeed( lyonnessespeed.LYONNESSESPEED_CREEPING, testEntity) sp = lyonnessespeed.get_lyonnessespeed( lyonnessespeed.LYONNESSESPEED_DELIBERATE) dur = lyonnessemass.get_lyonnessemass(lyonnessemass.LYONNESSEMASS_LARGE) testContent = hydracontent.create_hydra_content(lyonnessecreature.LyonnesseCreature, owner = testEntity, strength = strength, agility=ag, speed=sp, durability=dur, wounds = 1, fatigue = 2, maxhits = 12 ) testContent.put() result = hydracontent.load_hydra_content( testEntity) self.assertIsNotNone(result) result = db.get( testContent.key()) self.assertEqual( result.owner, testEntity) self.assertIsInstance( result, lyonnessecreature.LyonnesseCreature) self.assertEqual( result.strength, strength) self.assertEqual( result.agility, ag) self.assertEqual( result.speed, sp) self.assertEqual( result.durability, dur) self.assertEqual( result.maxhits, 12) self.assertEqual( result.wounds, 1) self.assertEqual( result.fatigue, 2)
def testEnumerateLyonnesseSpeed(self): emailAddr='*****@*****.**' testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr)) result = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_STATIONARY, owner=testEntity) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnessespeed.LYONNESSESPEED_STATIONARY) self.assertEqual( result.valName, 'Stationary') result = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_CREEPING) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnessespeed.LYONNESSESPEED_CREEPING) self.assertEqual( result.valName, 'Creeping') result = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_PLODDING) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnessespeed.LYONNESSESPEED_PLODDING) self.assertEqual( result.valName, 'Plodding') result = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_DELIBERATE) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnessespeed.LYONNESSESPEED_DELIBERATE) self.assertEqual( result.valName, 'Deliberate') result = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_SLOW) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnessespeed.LYONNESSESPEED_SLOW) self.assertEqual( result.valName, 'Slow') result = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_AVERAGE) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnessespeed.LYONNESSESPEED_AVERAGE) self.assertEqual( result.valName, 'Average') result = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_ENERGETIC) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnessespeed.LYONNESSESPEED_ENERGETIC) self.assertEqual( result.valName, 'Energetic') result = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_QUICK) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnessespeed.LYONNESSESPEED_QUICK) self.assertEqual( result.valName, 'Quick') result = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_SWIFT) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnessespeed.LYONNESSESPEED_SWIFT) self.assertEqual( result.valName, 'Swift') result = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_IMMEDIATE) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnessespeed.LYONNESSESPEED_IMMEDIATE) self.assertEqual( result.valName, 'Immediate') result = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_INSTANTANEOUS) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnessespeed.LYONNESSESPEED_INSTANTANEOUS) self.assertEqual( result.valName, 'Instantaneous') result = lyonnessespeed.get_lyonnessespeed(lyonnessespeed.LYONNESSESPEED_CHARACTERS) self.assertIsNotNone(result) self.assertEqual( result.value, lyonnessespeed.LYONNESSESPEED_CHARACTERS) self.assertEqual( result.valName, "Character's")