Example #1
0
    def testCloneNPC(self):
        eAddrs=['*****@*****.**',
                '*****@*****.**']
        testEntity = hydrauser.create_hydra_user(users.User(email=eAddrs[0]))
        origPub = hydrauser.create_hydra_user(users.User(email=eAddrs[1]))

        testName = "testCloneNPC"
        testContent = hydracontent.create_hydra_content(
                            npc.NPC,
                            owner=origPub,
                            originalPublisher=origPub,
                            instanceName = testName)

        dummy = hydracontent.create_hydra_content(
            npc.NPC,
            owner=testEntity,
            instanceName='dummy')
        dummy.put()
        testContent.challenges = []
        testContent.challenges.append( dummy.key())
        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, npc.NPC)
        self.assertEqual( len(result.challenges), 1)
        self.assertEqual( result.challenges[0], dummy)
Example #2
0
    def testCloneChallenge(self):
        eAddrs=['*****@*****.**',
                '*****@*****.**']
        testEntity = hydrauser.create_hydra_user(users.User(email=eAddrs[0]))
        origPub = hydrauser.create_hydra_user(users.User(email=eAddrs[1]))

        testName = "testInsertCreature"
        testContent = hydracontent.create_hydra_content(
                            creature.Creature,
                            owner=origPub,
                            originalPublisher=origPub,
                            instanceName = testName)

        dummy = hydracontent.create_hydra_content(
            hydracontent.HydraContent,
            owner=testEntity,
            instanceName='dummy')
        dummy.put()
        testContent.talents = []
        testContent.talents.append( dummy.key())
        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, creature.Creature)
        self.assertEqual( len(result.talents), 1)
        self.assertEqual( result.talents[0], dummy)
Example #3
0
    def testInsertCreature(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        testContent = hydracontent.create_hydra_content(
                            creature.Creature,
                            owner=testEntity)

        dummy = hydracontent.create_hydra_content(
            creature.Creature,
            owner=testEntity,
            instanceName='dummy')
        dummy.put()
        testContent.talents = []
        testContent.talents.append( dummy.key())
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)
        self.assertEqual( len(result), 2)

        result = db.get( testContent.key())
        self.assertEqual( result.owner, testEntity)
        self.assertIsInstance( result, creature.Creature)
        self.assertEqual( len(result.talents), 1)
        self.assertEqual( db.get(result.talents[0]), dummy)
Example #4
0
    def testInsertPDMap(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        dummy = hydracontent.create_hydra_content(
            pdmap.PDMap,
            owner=testEntity,
            instanceName='dummy')
        dummy.put()
        testContent = hydracontent.create_hydra_content(
                            pdmap.PDMap,
                            owner=testEntity)

        testContent.masks = []
        testContent.masks.append( dummy.key())
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)
        self.assertEqual( len(result), 2)

        result = db.get( testContent.key())
        self.assertEqual( result.owner, testEntity)
        self.assertIsInstance( result, pdmap.PDMap)
        self.assertEqual( len(result.masks), 1)
        self.assertEqual( db.get(result.masks[0]), dummy)
Example #5
0
    def testCloneEncounter(self):
        eAddrs=['*****@*****.**',
                '*****@*****.**']
        testEntity = hydrauser.create_hydra_user(users.User(email=eAddrs[0]))
        origPub = hydrauser.create_hydra_user(users.User(email=eAddrs[1]))

        testName = "testCloneEncounter"
        testContent = hydracontent.create_hydra_content(
                            pdmap.PDMap,
                            owner=origPub,
                            originalPublisher=origPub,
                            instanceName = testName)

        dummy = hydracontent.create_hydra_content(
            pdmap.PDMap,
            owner=testEntity,
            instanceName='dummy')
        dummy.put()
        testContent.masks = []
        testContent.masks.append( dummy.key())
        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, pdmap.PDMap)
        self.assertEqual( len(result.masks), 1)
        self.assertEqual( result.masks[0], dummy)
Example #6
0
    def testCloneCampaign(self):
        eAddrs=['*****@*****.**',
                '*****@*****.**']
        testEntity = hydrauser.create_hydra_user(users.User(email=eAddrs[0]))
        origPub = hydrauser.create_hydra_user(users.User(email=eAddrs[1]))

        testName = "testCloneCampaign"
        testContent = hydracontent.create_hydra_content(
                            campaign.Campaign,
                            owner=origPub,
                            originalPublisher=origPub,
                            instanceName = testName)

        dummy = hydracontent.create_hydra_content(
            campaign.Campaign,
            owner=testEntity,
            instanceName='dummy')
        testContent.sessions = []
        testContent.sessions.append( dummy.put())
        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, campaign.Campaign)
        self.assertEqual( len(result.sessions), 1)
        self.assertEqual( result.sessions[0], dummy)
Example #7
0
    def testCloneContentToContent(self):
        eAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=eAddr))

        testNames = ['testCloneContentToContent0',
                     'testCloneContentToContent1']
        testContent0 = hydracontent.create_hydra_content(hydracontent.HydraContent,
                                    owner=testEntity,
                                    instanceName=testNames[0]
                                    )
        testContent0.put()
        testContent1 = hydracontent.create_hydra_content(hydracontent.HydraContent,
                                    owner=testEntity,
                                    instanceName=testNames[1]
                                    )
        testContent1.put()

        # clone the content to an item owned by the first content item
        result = testContent1.clone( testContent0)

        self.assertIsNot( result, testContent1)
        self.assertIsNot( result, testContent0)
        self.assertEqual( result.owner, testEntity)
        self.assertEqual( testContent0.owner, testEntity)
        self.assertEqual( testContent1.owner, testEntity)
        self.assertEqual( result.instanceName, testNames[1])
        self.assertEqual( testContent0.instanceName, testNames[0])
        self.assertEqual( testContent1.instanceName, testNames[1])
        self.assertEqual( len(result.contentSet), 0)
        self.assertEqual( len(testContent0.contentSet), 1)
        self.assertEqual( len(testContent1.contentSet), 0)
Example #8
0
    def testInsertCampaign(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        testContent = hydracontent.create_hydra_content(
                            campaign.Campaign,
                            owner=testEntity)

        dummy = hydracontent.create_hydra_content(
            campaign.Campaign,
            owner=testEntity,
            instanceName='dummy')
        testContent.sessions = []
        testContent.sessions.append( dummy.put())
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)
        self.assertEqual( len(result), 2)

        result = db.get( testContent.key())
        self.assertEqual( result.owner, testEntity)
        self.assertIsInstance( result, campaign.Campaign)
        self.assertEqual( len(result.sessions), 1)
        self.assertEqual( db.get(result.sessions[0]), dummy)
Example #9
0
    def testCloneParty(self):
        eAddrs=['*****@*****.**',
                '*****@*****.**']
        testEntity = hydrauser.create_hydra_user(users.User(email=eAddrs[0]))
        origPub = hydrauser.create_hydra_user(users.User(email=eAddrs[1]))

        dummy = hydracontent.create_hydra_content(
            party.Party,
            owner=testEntity,
            instanceName='dummy')
        dummy.put()
        testName = "testCloneParty"
        testContent = hydracontent.create_hydra_content(
                            party.Party,
                            owner=origPub,
                            originalPublisher=origPub,
                            partyMorale=dummy,
                            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, party.Party)
        self.assertEqual(result.partyMorale, dummy)
Example #10
0
    def testCloneItem(self):
        eAddrs=['*****@*****.**',
                '*****@*****.**']
        testEntity = hydrauser.create_hydra_user(users.User(email=eAddrs[0]))
        origPub = hydrauser.create_hydra_user(users.User(email=eAddrs[1]))

        dummy = hydracontent.create_hydra_content(
            hydracontent.HydraContent,
            owner=testEntity,
            instanceName='dummy')
        dummy.put()

        testName = "testCloneItem"
        testContent = hydracontent.create_hydra_content(
                            item.Item,
                            mass = dummy,
                            owner=origPub,
                            originalPublisher=origPub,
                            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, item.Item)
        self.assertEqual( result.mass, dummy)
    def testInsertLyonnesseCreatureHistory(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        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()
        testContent = hydracontent.create_hydra_content(lyonnessecreaturehistory.LyonnesseCreatureHistory,
                                                        owner = testEntity,
                                                        logEntries = [testLE.key()]
                                                        )
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)

        result = db.get( testContent.key())
        self.assertEqual( result.owner, testEntity)
        self.assertIsInstance( result, lyonnessecreaturehistory.LyonnesseCreatureHistory)
        self.assertEqual( len( result.logEntries), 1)

        result = db.get( result.logEntries[0])  # logentry
        self.assertIsNotNone( result)
        self.assertEqual( result.owner, testEntity)
        self.assertIsInstance( result, lyonnesselogentry.LyonnesseLogEntry)
        self.assertEqual( result.instanceName, testName)
        self.assertEqual( result.description, testDesc)
Example #12
0
    def testInsertNPC(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        testContent = hydracontent.create_hydra_content(
                            npc.NPC,
                            owner=testEntity)
        testContent.challenges = []

        dummy = hydracontent.create_hydra_content(
            npc.NPC,
            owner=testEntity,
            instanceName='dummy')
        dummy.put()
        testContent.challenges.append( dummy.key())
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)
        self.assertEqual( len(result), 2)

        result = db.get( testContent.key())
        self.assertEqual( result.owner, testEntity)
        self.assertIsInstance( result, npc.NPC)
        self.assertEqual( len(result.challenges), 1)
        self.assertEqual( db.get(result.challenges[0]), dummy)
Example #13
0
    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 testInsertLyonnesseArmor(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        testMass = lyonnessemass.get_lyonnessemass(lyonnessemass.LYONNESSEMASS_LARGE,
                                                   owner=testEntity)
        testProt = lyonnesseprotection.get_lyonnesseprotection(lyonnesseprotection.LYONESSEPROTECTION_MEDIUM,
                                                               testEntity)
        testContent = hydracontent.create_hydra_content(
                                                        lyonnessearmor.LyonnesseArmor,
                                                        owner = testEntity,
                                                        mass = testMass,
                                                        protection = testProt,
                                                        cover = "Full Body"
                                                        )
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)

        result = db.get( testContent.key())
        self.assertEqual( result.owner, testEntity)
        self.assertIsInstance( result, lyonnessearmor.LyonnesseArmor)
        self.assertEqual( result.cover, "Full Body")
        self.assertEqual( result.mass, testMass)
        self.assertEqual( result.protection, testProt)
    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__
Example #17
0
    def testCloneToContentWithContent(self):
        eAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=eAddr))

        testNames = ['testCloneContentToContent0',
                     'testCloneContentToContent1',
                     'subcontent']
        testContent = []
        for t in testNames:
            c = hydracontent.create_hydra_content( hydracontent.HydraContent,
                    owner=testEntity,
                    instanceName=t)
            c.put()
            testContent.append(c)

        # clone the content to an item owned by the first content item
        c0 = testContent[2].clone( testContent[0])
        c1 = testContent[1].clone( testContent[0])

        self.assertIsNot( c0, testContent[2])
        self.assertIsNot( c1, testContent[1])
        self.assertEqual( c0.owner, testEntity)
        self.assertEqual( c1.owner, testEntity)
        self.assertEqual( c0.instanceName, testNames[2])
        self.assertEqual( c1.instanceName, testNames[1])
        self.assertEqual( len(c0.contentSet), 0)
        self.assertEqual( len(c1.contentSet), 0)
        self.assertEqual( len(testContent[0].contentSet), 2)
Example #18
0
    def testInsertPDFContent(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        testContent = hydracontent.create_hydra_content(
                            pdfcontent.PDFContent,
                            owner=testEntity)
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)
        self.assertEqual( len(result), 1)
        self.assertEqual( result[0].owner, testEntity)
        self.assertIsInstance( result[0], pdfcontent.PDFContent)
Example #19
0
    def testInsertParty(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        dummy = hydracontent.create_hydra_content(
            party.Party,
            owner=testEntity,
            instanceName='dummy')
        dummy.put()
        testContent = hydracontent.create_hydra_content(
                            party.Party,
                            partyMorale=dummy,
                            owner=testEntity)
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)
        self.assertEqual( len(result), 2)

        result = db.get( testContent.key())
        self.assertEqual( result.owner, testEntity)
        self.assertIsInstance( result, party.Party)
        self.assertEqual( result.partyMorale, dummy)
    def testCloneLyonnesseCreatureHistory(self):
        eAddrs=['*****@*****.**',
                '*****@*****.**']
        testEntity = hydrauser.create_hydra_user(users.User(email=eAddrs[0]))
        origPub = hydrauser.create_hydra_user(users.User(email=eAddrs[1]))

        testName = "Instance Name"
        testDesc = "I want to ride my bicycle"
        testLE = hydracontent.create_hydra_content(lyonnesselogentry.LyonnesseLogEntry,
                                                   owner = origPub,
                                                   originalPublisher = origPub,
                                                   instanceName = testName,
                                                   description = testDesc
                                                   )
        testLE.put()
        testContent = hydracontent.create_hydra_content(lyonnessecreaturehistory.LyonnesseCreatureHistory,
                                                        owner = origPub,
                                                        originalPublisher = origPub,
                                                        logEntries = [testLE.key()]
                                                        )
        testContent.put()

        result = testContent.clone( testEntity)
        self.assertIsNot( result, testContent)
        self.assertEqual(result.owner, testEntity)
        self.assertEqual(result.originalPublisher, origPub)
        self.assertIsInstance( result, lyonnessecreaturehistory.LyonnesseCreatureHistory)
        self.assertEqual( len( result.logEntries), 1)

        result = db.get( result.logEntries[0])  # logentry
        self.assertIsNotNone( result)
        self.assertEqual( result.owner, testEntity)
        self.assertEqual(result.originalPublisher, origPub)
        self.assertIsInstance( result, lyonnesselogentry.LyonnesseLogEntry)
        self.assertEqual( result.instanceName, testName)
        self.assertEqual( result.description, testDesc)
Example #21
0
    def testInsertItem(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        dummy = hydracontent.create_hydra_content(
            item.Item,
            owner=testEntity,
            instanceName='dummy')
        dummy.put()

        testContent = hydracontent.create_hydra_content(
                            item.Item,
                            mass = dummy,
                            owner=testEntity)
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)
        self.assertEqual( len(result), 2)

        result = db.get( testContent.key())
        self.assertEqual( result.owner, testEntity)
        self.assertIsInstance( result, item.Item)
        self.assertEqual( result.mass, dummy)
Example #22
0
    def testInsertHydraContent(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        testName = "testInsertHydraContent"
        testContent = hydracontent.create_hydra_content(hydracontent.HydraContent,
                                    owner=testEntity,
                                    instanceName=testName
                                    )
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)
        self.assertEqual( len(result), 1)
        self.assertEqual( result[0].owner, testEntity)
        self.assertEqual( result[0].instanceName, testName)
Example #23
0
    def testInsertSession(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        testContent = hydracontent.create_hydra_content(
                            session.Session,
                            owner=testEntity)
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)
        self.assertEqual( len(result), 1)

        result = db.get( testContent.key())
        self.assertEqual( result.owner, testEntity)
        self.assertIsInstance( result, session.Session)
Example #24
0
    def testInsertAbstractItem(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        testName = 'testInsertAbstractItem'
        testContent = hydracontent.create_hydra_content(
                            abstractitem.AbstractItem,
                            owner=testEntity,
                            category=testName)
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)
        self.assertEqual( len(result), 1)
        self.assertEqual( result[0].owner, testEntity)
        self.assertEqual( result[0].category, testName)
        self.assertIsInstance( result[0], abstractitem.AbstractItem)
Example #25
0
    def testInsertLyonnesseItem(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        testContent = hydracontent.create_hydra_content( lyonnesseitem.LyonnesseItem,
                                                         damaged = True,
                                                         owner = testEntity
                                                         )
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)

        result = db.get( testContent.key())
        self.assertEqual( result.owner, testEntity)
        self.assertIsInstance( result, lyonnesseitem.LyonnesseItem)
        self.assertEqual( result.damaged, True)
Example #26
0
    def testInsertHydraMap(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        loc = [1.0,2.0,3.0,4.0]
        testContent = hydracontent.create_hydra_content(
                            hydramap.HydraMap,
                            owner=testEntity,
                            location=loc)
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)
        self.assertEqual( len(result), 1)
        self.assertEqual( result[0].owner, testEntity)
        self.assertIsInstance( result[0], hydramap.HydraMap)
        self.assertEqual( len(result[0].location), 4)
        self.assertEqual( result[0].locations[0], 1.0)
    def testInsertHydraGameSystem(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        testName = '1.0'
        testContent = hydracontent.create_hydra_content(
                            hydragamesystem.HydraGameSystem,
                            owner=testEntity,
                            version=testName
                            )
        testContent.put()

        result = hydracontent.load_hydra_content( testEntity)
        self.assertIsNotNone(result)
        self.assertEqual( len(result), 1)
        self.assertEqual( result[0].owner, testEntity)
        self.assertIsInstance( result[0], hydragamesystem.HydraGameSystem)
        self.assertEqual( result[0].version, testName)
    def testClonePlayerCharacter(self):
        eAddrs=['*****@*****.**',
                '*****@*****.**']
        testEntity = hydrauser.create_hydra_user(users.User(email=eAddrs[0]))
        origPub = hydrauser.create_hydra_user(users.User(email=eAddrs[1]))

        testName = "testClonePlayerCharacter"
        testContent = hydracontent.create_hydra_content(
                            playercharacter.PlayerCharacter,
                            owner=origPub,
                            originalPublisher=origPub,
                            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, playercharacter.PlayerCharacter)
Example #29
0
    def testCloneGameSystem(self):
        eAddrs=['*****@*****.**',
                '*****@*****.**']
        testEntity = hydrauser.create_hydra_user(users.User(email=eAddrs[0]))
        origPub = hydrauser.create_hydra_user(users.User(email=eAddrs[1]))

        testName = "testInsertPDFContent"
        testContent = hydracontent.create_hydra_content(
                            pdfcontent.PDFContent,
                            owner=origPub,
                            originalPublisher=origPub,
                            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, pdfcontent.PDFContent)
Example #30
0
    def testCloneAdventure(self):
        eAddrs=['*****@*****.**',
                '*****@*****.**']
        testEntity = hydrauser.create_hydra_user(users.User(email=eAddrs[0]))
        origPub = hydrauser.create_hydra_user(users.User(email=eAddrs[1]))

        testName = "testCloneAdventure"
        testContent = hydracontent.create_hydra_content(
                            adventure.Adventure,
                            owner=origPub,
                            originalPublisher=origPub,
                            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, adventure.Adventure)