Example #1
0
    def test_get_entity_dict(self):
        class MyModel(db.Model):
            animal = db.StringProperty()
            species = db.IntegerProperty()
            description = db.TextProperty()

        entity = MyModel(animal='duck', species=12,
            description='A duck, a bird that swims well.')
        values = ext_db.get_entity_dict(entity)

        self.assertEqual(values, {
            'animal': 'duck',
            'species': 12,
            'description': 'A duck, a bird that swims well.',
        })
Example #2
0
    def test_get_entity_dict(self):
        class MyModel(db.Model):
            animal = db.StringProperty()
            species = db.IntegerProperty()
            description = db.TextProperty()

        entity = MyModel(animal='duck', species=12,
            description='A duck, a bird that swims well.')
        values = ext_db.get_entity_dict(entity)

        self.assertEqual(values, {
            'animal': 'duck',
            'species': 12,
            'description': 'A duck, a bird that swims well.',
        })
Example #3
0
    def test_get_entity_dict_multiple(self):
        class MyModel(db.Model):
            animal = db.StringProperty()
            species = db.IntegerProperty()
            description = db.TextProperty()

        entity = MyModel(animal='duck',
                         species=12,
                         description='A duck, a bird that swims well.')
        entity2 = MyModel(animal='bird',
                          species=7,
                          description='A bird, an animal that flies well.')
        values = ext_db.get_entity_dict([entity, entity2])

        self.assertEqual(
            values, [{
                'animal': 'duck',
                'species': 12,
                'description': 'A duck, a bird that swims well.',
            }, {
                'animal': 'bird',
                'species': 7,
                'description': 'A bird, an animal that flies well.',
            }])
Example #4
0
    def test_get_entity_dict_multiple(self):
        class MyModel(db.Model):
            animal = db.StringProperty()
            species = db.IntegerProperty()
            description = db.TextProperty()

        entity = MyModel(animal='duck', species=12,
            description='A duck, a bird that swims well.')
        entity2 = MyModel(animal='bird', species=7,
            description='A bird, an animal that flies well.')
        values = ext_db.get_entity_dict([entity, entity2])

        self.assertEqual(values, [
            {
                'animal': 'duck',
                'species': 12,
                'description': 'A duck, a bird that swims well.',
            },
            {
                'animal': 'bird',
                'species': 7,
                'description': 'A bird, an animal that flies well.',
            }
        ])