def testCreateLyonnesseProtection(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        testContent = lyonnesseprotection.get_lyonnesseprotection(lyonnesseprotection.LYONESSEPROTECTION_NEGLIGIBLE,
                                                                     owner=testEntity
                                                                     )

        result = lyonnesseprotection.get_lyonnesseprotection(lyonnesseprotection.LYONESSEPROTECTION_NEGLIGIBLE)
        self.assertIsNotNone(result)
        self.assertEqual( result, testContent)
        self.assertEqual( result.value, lyonnesseprotection.LYONESSEPROTECTION_NEGLIGIBLE)
        self.assertEqual( result.valName, 'Negligible')
Exemplo n.º 2
0
    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 testEnumerateLyonnesseProtection(self):
        emailAddr='*****@*****.**'
        testEntity = hydrauser.create_hydra_user(users.User(email=emailAddr))

        result = lyonnesseprotection.get_lyonnesseprotection(lyonnesseprotection.LYONESSEPROTECTION_NEGLIGIBLE,
                                                             owner=testEntity)
        self.assertIsNotNone(result)
        self.assertEqual( result.value, lyonnesseprotection.LYONESSEPROTECTION_NEGLIGIBLE)
        self.assertEqual( result.valName, 'Negligible')
    
        result = lyonnesseprotection.get_lyonnesseprotection(lyonnesseprotection.LYONESSEPROTECTION_TINY)
        self.assertIsNotNone(result)
        self.assertEqual( result.value, lyonnesseprotection.LYONESSEPROTECTION_TINY)
        self.assertEqual( result.valName, 'Tiny')

        result = lyonnesseprotection.get_lyonnesseprotection(lyonnesseprotection.LYONESSEPROTECTION_LIGHT)
        self.assertIsNotNone(result)
        self.assertEqual( result.value, lyonnesseprotection.LYONESSEPROTECTION_LIGHT)
        self.assertEqual( result.valName, 'Light')

        result = lyonnesseprotection.get_lyonnesseprotection(lyonnesseprotection.LYONESSEPROTECTION_MEDIUM)
        self.assertIsNotNone(result)
        self.assertEqual( result.value, lyonnesseprotection.LYONESSEPROTECTION_MEDIUM)
        self.assertEqual( result.valName, 'Medium')

        result = lyonnesseprotection.get_lyonnesseprotection(lyonnesseprotection.LYONESSEPROTECTION_HEAVY)
        self.assertIsNotNone(result)
        self.assertEqual( result.value, lyonnesseprotection.LYONESSEPROTECTION_HEAVY)
        self.assertEqual( result.valName, 'Heavy')

        result = lyonnesseprotection.get_lyonnesseprotection(lyonnesseprotection.LYONESSEPROTECTION_DEVASTATING)
        self.assertIsNotNone(result)
        self.assertEqual( result.value, lyonnesseprotection.LYONESSEPROTECTION_DEVASTATING)
        self.assertEqual( result.valName, 'Devastating')