def test_put_feature_with_same_key_without_revision(self): entry = FeatureEntry(self.bucket) response = entry.put_feature(self.test_key, self.test_feature1) response = entry.put_feature(self.test_key, self.test_feature2) self.assertIsInstance(response, Response) self.assertEqual(response.key, self.test_key) response, feature = entry.get_feature(self.test_key) self.assertEqual(feature.key, self.test_key) self.assertTrue(feature.equals(self.test_feature2))
def test_get_feature(self): test_key = Key.make_key(bucket=self.bucket.bucket_name, name='alice') test_feature1 = Feature.build_from_geometry( 'POINT (8 8)', properties=dict(x=8, y=8), ) entry = FeatureEntry(self.bucket) response = entry.put_feature(test_key, test_feature1) # get a feature response, feature = entry.get_feature(test_key) self.assertEqual(feature.key, test_key) self.assertTrue(feature.equals(test_feature1))
def test_buckets(self): self.storage.create_bucket('bob', srid=4326, overwrite=True) bucket = self.storage.get_bucket('bob') self.assertIsNotNone(bucket) test_key = Key.make_key(bucket='test_bucket', name='alice') test_feature = Feature.build_from_geometry( 'POINT (8 8)', properties=dict(x=8, y=8), ) visitor = FeatureEntry(bucket) response = visitor.put_feature(test_key, test_feature) response, feature = visitor.get_feature(test_key) self.assertTrue(feature.equals(test_feature)) response = visitor.delete_feature(test_key) self.assertRaises(FeatureNotFound, visitor.get_feature, test_key) self.storage.delete_bucket('bob') self.assertRaises(BucketNotFound, self.storage.get_bucket, 'bob')