Example #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)
Example #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)
Example #3
0
 def testCreateOrganization(self):
     id = 'organization/museum-of-vertebrate-zoology'
     props = dict(description='about', name='MVZ')
     organization = Organization(id=id, **props)
     self.assertIsNotNone(organization)
     self.assertEqual(id, organization.key.id())
     self.assertIsNotNone(organization.json)
     self.assertIsInstance(organization.json, dict)
     self.assertIsNotNone(organization.message)
     self.assertIsInstance(organization.message, OrganizationPayload)
Example #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)
Example #5
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)