Exemple #1
0
    def testCreateDataset(self):
        oid = 'museum-of-vertebrate-zoology'
        props = dict(description='about', name='MVZ')
        organization = Organization(id=oid, **props)
        organization.put()

        rid = 'museum-of-vertebrate-zoology/birds-resource'
        props = dict(organization=organization.key,
                     organization_id=organization.key.id(),
                     title='birds')
        resource = Resource(id=rid, **props)
        resource.put()

        did = 'museum-of-vertebrate-zoology/bird-resource/aves'
        props = dict(organization=organization.key,
                     organization_id=organization.key.id(),
                     resource=resource.key,
                     resource_id=resource.key.id(),
                     title='aves')
        dataset = Dataset(id=did, **props)
        dataset.put()

        self.assertIsNotNone(dataset)
        self.assertEqual(did, dataset.key.id())
        self.assertIsNotNone(dataset.json)
        self.assertIsInstance(dataset.json, dict)
        self.assertIsNotNone(dataset.message)
        self.assertIsInstance(dataset.message, DatasetPayload)
        self.assertEqual(dataset.organization, organization.key)
        self.assertEqual(dataset.resource, resource.key)
Exemple #2
0
    def testCreateDataset(self):
        oid = 'museum-of-vertebrate-zoology'
        props = dict(description='about', name='MVZ')
        organization = Organization(id=oid, **props)
        organization.put()
    
        rid = 'museum-of-vertebrate-zoology/birds-resource'
        props = dict(organization=organization.key, 
            organization_id=organization.key.id(), title='birds')
        resource = Resource(id=rid, **props)
        resource.put()

        did = 'museum-of-vertebrate-zoology/bird-resource/aves'
        props = dict(organization=organization.key, 
             organization_id=organization.key.id(), resource=resource.key,
             resource_id=resource.key.id(), title='aves')
        dataset = Dataset(id=did, **props)
        dataset.put()

        self.assertIsNotNone(dataset)
        self.assertEqual(did, dataset.key.id())
        self.assertIsNotNone(dataset.json)
        self.assertIsInstance(dataset.json, dict)
        self.assertIsNotNone(dataset.message)
        self.assertIsInstance(dataset.message, DatasetPayload)
        self.assertEqual(dataset.organization, organization.key)
        self.assertEqual(dataset.resource, resource.key)
Exemple #3
0
    def testCreateResource(self):
        oid = 'organization/museum-of-vertebrate-zoology'
        props = dict(description='about', name='MVZ')
        organization = Organization(id=oid, **props)
        organization.put()
    
        rid = 'birds'
        props = dict(organization=organization.key, 
            organization_id=organization.key.id(), title='birds')
        resource = Resource(id=rid, **props)
        resource.put()

        self.assertIsNotNone(resource)
        self.assertEqual(rid, resource.key.id())
        self.assertIsNotNone(resource.json)
        self.assertIsInstance(resource.json, dict)
        self.assertIsNotNone(resource.message)
        self.assertIsInstance(resource.message, ResourcePayload)
        self.assertEqual(resource.organization, organization.key)
        self.assertEqual(organization.key.id(), oid)
Exemple #4
0
    def testCreateResource(self):
        oid = 'organization/museum-of-vertebrate-zoology'
        props = dict(description='about', name='MVZ')
        organization = Organization(id=oid, **props)
        organization.put()

        rid = 'birds'
        props = dict(organization=organization.key,
                     organization_id=organization.key.id(),
                     title='birds')
        resource = Resource(id=rid, **props)
        resource.put()

        self.assertIsNotNone(resource)
        self.assertEqual(rid, resource.key.id())
        self.assertIsNotNone(resource.json)
        self.assertIsInstance(resource.json, dict)
        self.assertIsNotNone(resource.message)
        self.assertIsInstance(resource.message, ResourcePayload)
        self.assertEqual(resource.organization, organization.key)
        self.assertEqual(organization.key.id(), oid)