def test_enumerate_attribute_values(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(public=True) tablename = "table_%d" % layer_id settings = { "layers": { "enum": { "layer_test": { "table": tablename, "attributes": { "label": { "column_name": "name" } } } } } } request = self._get_request(layer_id) request.registry.settings.update(settings) request.matchdict["layer_name"] = "layer_test" request.matchdict["field_name"] = "label" layers = Layers(request) response = layers.enumerate_attribute_values() self.assertEquals(response, { "items": [{ "label": "bar", "value": "bar" }, { "label": "foo", "value": "foo" }] })
def test_create_log(self): from datetime import datetime from geojson.feature import FeatureCollection from c2cgeoportal.views.layers import Layers from c2cgeoportal.models import Metadata from c2cgeoportal.models import DBSession, User self.assertEqual( DBSession.query(User.username).all(), [("__test_user", )]) metadatas = [ Metadata("lastUpdateDateColumn", "last_update_date"), Metadata("lastUpdateUserColumn", "last_update_user"), ] layer_id = self._create_layer(metadatas=metadatas) request = self._get_request(layer_id, username="******") request.method = "POST" request.body = '{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"name": "foo", "child": "c1é"}, "geometry": {"type": "Point", "coordinates": [5, 45]}}]}' # noqa layers = Layers(request) collection = layers.create() self.assertEqual(request.response.status_int, 201) self.assertTrue(isinstance(collection, FeatureCollection)) self.assertEqual(len(collection.features), 1) properties = collection.features[0] self.assertEqual(request.user.username, "__test_user") self.assertEqual(properties.last_update_user, request.user.id) self.assertIsInstance(properties.last_update_date, datetime)
def test_enumerate_attribute_values(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(public=True) tablename = "table_%d" % layer_id settings = { "layers": { "enum": { "layer_test": { "table": tablename, "attributes": { "label": { "column_name": "name" } } } } } } request = self._get_request(layer_id) request.registry.settings.update(settings) request.matchdict['layer_name'] = 'layer_test' request.matchdict['field_name'] = 'label' layers = Layers(request) response = layers.enumerate_attribute_values() self.assertEquals(response, { 'items': [{ 'label': 'bar', 'value': 'bar' }, { 'label': 'foo', 'value': 'foo' }] })
def test_enumerate_attribute_values(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(public=True) tablename = "table_%d" % layer_id settings = { 'layers_enum': { 'layer_test': { 'table': tablename, 'attributes': { 'label': { 'column_name': 'name' } } } } } request = self._get_request(layer_id) request.registry.settings.update(settings) request.matchdict['layer_name'] = 'layer_test' request.matchdict['field_name'] = 'label' layers = Layers(request) response = layers.enumerate_attribute_values() self.assertEquals( response, { 'items': [{ 'label': 'bar', 'value': 'bar' }, { 'label': 'foo', 'value': 'foo' }] })
def test_count_none_area(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(none_area=True) request = self._get_request(layer_id) layers = Layers(request) response = layers.count() self.assertEquals(response, 2)
def test_metadata_exclude_properties(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(exclude_properties=True) request = self._get_request(layer_id, username=u"__test_user") layers = Layers(request) cls = layers.metadata() self.assertFalse(hasattr(cls, "name"))
def test_metadata_exclude_properties(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(exclude_properties=True) request = self._get_request(layer_id, username=u'__test_user') layers = Layers(request) cls = layers.metadata() self.assertFalse(hasattr(cls, 'name'))
def test_delete_none_area(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(none_area=True) request = self._get_request(layer_id, username=u'__test_user') request.matchdict['feature_id'] = 1 request.method = 'DELETE' layers = Layers(request) response = layers.delete() self.assertEquals(response.status_int, 204)
def test_delete_none_area(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(none_area=True) request = self._get_request(layer_id, username=u"__test_user") request.matchdict["feature_id"] = 1 request.method = "DELETE" layers = Layers(request) response = layers.delete() self.assertEquals(response.status_int, 204)
def test_delete(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer() request = self._get_request(layer_id, username=u'__test_user') request.matchdict['feature_id'] = 1 request.method = 'DELETE' layers = Layers(request) response = layers.delete() self.assertEquals(response.status_int, 204)
def test_delete(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer() request = self._get_request(layer_id, username=u"__test_user") request.matchdict["feature_id"] = 1 request.method = "DELETE" layers = Layers(request) response = layers.delete() self.assertEquals(response.status_int, 204)
def test_metadata(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer() request = self._get_request(layer_id, username=u"__test_user") layers = Layers(request) cls = layers.metadata() self.assertEquals(cls.__table__.name, "table_%d" % layer_id) self.assertTrue(hasattr(cls, "name")) self.assertTrue("child" in cls.__dict__)
def test_read_one_public_notfound(self): from pyramid.httpexceptions import HTTPNotFound from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(public=True) request = self._get_request(layer_id) request.matchdict["feature_id"] = 10000 layers = Layers(request) feature = layers.read_one() self.assertTrue(isinstance(feature, HTTPNotFound))
def test_metadata(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer() request = self._get_request(layer_id, username=u'__test_user') layers = Layers(request) cls = layers.metadata() self.assertEquals(cls.__table__.name, 'table_%d' % layer_id) self.assertTrue(hasattr(cls, 'name')) self.assertTrue('child' in cls.__dict__)
def test_read_many(self): from geojson.feature import FeatureCollection from c2cgeoportal.views.layers import Layers layer_id = self._create_layer() request = self._get_request(layer_id, username=u"__test_user") layers = Layers(request) collection = layers.read_many() self.assertTrue(isinstance(collection, FeatureCollection)) self.assertEquals([f.properties["child"] for f in collection.features], [u"c1é"])
def test_read_one_public_notfound(self): from pyramid.httpexceptions import HTTPNotFound from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(public=True) request = self._get_request(layer_id) request.matchdict['feature_id'] = 10000 layers = Layers(request) feature = layers.read_one() self.assertTrue(isinstance(feature, HTTPNotFound))
def test_create_none_area(self): from geojson.feature import FeatureCollection from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(none_area=True) request = self._get_request(layer_id, username=u'__test_user') request.method = 'POST' request.body = '{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"name": "foo", "child": "c1é"}, "geometry": {"type": "Point", "coordinates": [5, 45]}}, {"type": "Feature", "properties": {"text": "foo", "child": "c2é"}, "geometry": {"type": "Point", "coordinates": [5, 45]}}]}' # NOQA layers = Layers(request) collection = layers.create() self.assertTrue(isinstance(collection, FeatureCollection)) self.assertEquals(len(collection.features), 2)
def test_read_many(self): from geojson.feature import FeatureCollection from c2cgeoportal.views.layers import Layers layer_id = self._create_layer() request = self._get_request(layer_id, username=u'__test_user') layers = Layers(request) collection = layers.read_many() self.assertTrue(isinstance(collection, FeatureCollection)) self.assertEquals(len(collection.features), 1) self.assertEquals(collection.features[0].properties['child'], u'c1é')
def test_create_validation_fails(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer() request = self._get_request(layer_id, username=u"__test_user") request.method = "POST" request.body = '{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"name": "foo", "child": "c1é"}, "geometry": {"type": "Point", "coordinates": [5, 45]}}, {"type": "Feature", "properties": {"text": "foo", "child": "c2é"}, "geometry": {"type": "LineString", "coordinates": [[5, 45], [5, 45]]}}]}' # noqa layers = Layers(request) response = layers.create() self.assertEquals(request.response.status_int, 400) self.assertTrue("validation_error" in response) self.assertEquals(response["validation_error"], "Too few points in geometry component[5 45]")
def test_create_none_area(self): from geojson.feature import FeatureCollection from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(none_area=True) request = self._get_request(layer_id, username=u"__test_user") request.method = "POST" request.body = '{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"name": "foo", "child": "c1é"}, "geometry": {"type": "Point", "coordinates": [5, 45]}}, {"type": "Feature", "properties": {"text": "foo", "child": "c2é"}, "geometry": {"type": "Point", "coordinates": [5, 45]}}]}' # noqa layers = Layers(request) collection = layers.create() self.assertTrue(isinstance(collection, FeatureCollection)) self.assertEquals(len(collection.features), 2)
def test_update_none_area(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(none_area=True) request = self._get_request(layer_id, username=u'__test_user') request.matchdict['feature_id'] = 1 request.method = 'PUT' request.body = '{"type": "Feature", "id": 1, "properties": {"name": "foobar", "child": "c2é"}, "geometry": {"type": "Point", "coordinates": [5, 45]}}' # NOQA layers = Layers(request) feature = layers.update() self.assertEquals(feature.id, 1) self.assertEquals(feature.name, 'foobar') self.assertEquals(feature.child, u'c2é')
def test_read_public_none_area(self): from geojson.feature import FeatureCollection from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(public=True, none_area=True) request = self._get_request(layer_id) layers = Layers(request) collection = layers.read_many() self.assertTrue(isinstance(collection, FeatureCollection)) self.assertEquals(len(collection.features), 2) self.assertEquals(collection.features[0].properties['child'], u'c1é') self.assertEquals(collection.features[1].properties['child'], u'c2é')
def test_update(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer() request = self._get_request(layer_id, username=u"__test_user") request.matchdict["feature_id"] = 1 request.method = "PUT" request.body = '{"type": "Feature", "id": 1, "properties": {"name": "foobar", "child": "c2é"}, "geometry": {"type": "Point", "coordinates": [5, 45]}}' # noqa layers = Layers(request) feature = layers.update() self.assertEquals(feature.id, 1) self.assertEquals(feature.name, "foobar") self.assertEquals(feature.child, u"c2é")
def test_read_many_none_area(self): from geojson.feature import FeatureCollection from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(none_area=True) request = self._get_request(layer_id, username=u"__test_user") layers = Layers(request) collection = layers.read_many() self.assertTrue(isinstance(collection, FeatureCollection)) self.assertEquals(len(collection.features), 2) self.assertEquals(collection.features[0].properties["child"], u"c1é") self.assertEquals(collection.features[1].properties["child"], u"c2é")
def test_update_validation_fails_simple(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer() request = self._get_request(layer_id, username=u"__test_user") request.matchdict["feature_id"] = 1 request.method = "PUT" request.body = '{"type": "Feature", "id": 1, "properties": {"name": "foobar", "child": "c2é"}, "geometry": {"type": "LineString", "coordinates": [[5, 45], [6, 45], [5, 45]]}}' # noqa layers = Layers(request) response = layers.update() self.assertEquals(request.response.status_int, 400) self.assertTrue("validation_error" in response) self.assertEquals(response["validation_error"], "Not simple")
def test_update_validation_fails(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer() request = self._get_request(layer_id, username=u'__test_user') request.matchdict['feature_id'] = 1 request.method = 'PUT' request.body = '{"type": "Feature", "id": 1, "properties": {"name": "foobar", "child": "c2é"}, "geometry": {"type": "LineString", "coordinates": [[5, 45], [5, 45]]}}' # noqa layers = Layers(request) response = layers.update() self.assertEquals(request.response.status_int, 400) self.assertTrue('validation_error' in response) self.assertEquals(response['validation_error'], 'Too few points in geometry component[5 45]')
def test_update_none_area(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(none_area=True) request = self._get_request(layer_id, username=u"__test_user") request.matchdict["feature_id"] = 1 request.method = "PUT" request.body = '{"type": "Feature", "id": 1, "properties": {"name": "foobar", "child": "c2é"}, "geometry": {"type": "Point", "coordinates": [5, 45]}}' # noqa layers = Layers(request) feature = layers.update() self.assertEquals(feature.id, 1) self.assertEquals(feature.name, "foobar") self.assertEquals(feature.child, u"c2é")
def test_update(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer() request = self._get_request(layer_id, username=u'__test_user') request.matchdict['feature_id'] = 1 request.method = 'PUT' request.body = '{"type": "Feature", "id": 1, "properties": {"name": "foobar", "child": "c2é"}, "geometry": {"type": "Point", "coordinates": [5, 45]}}' # noqa layers = Layers(request) feature = layers.update() self.assertEquals(feature.id, 1) self.assertEquals(feature.name, 'foobar') self.assertEquals(feature.child, u'c2é')
def test_read_one_none_area(self): from geojson.feature import Feature from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(none_area=True) request = self._get_request(layer_id, username=u"__test_user") request.matchdict["feature_id"] = 1 layers = Layers(request) feature = layers.read_one() self.assertTrue(isinstance(feature, Feature)) self.assertEquals(feature.id, 1) self.assertEquals(feature.properties["name"], "foo") self.assertEquals(feature.properties["child"], u"c1é")
def test_read_public_none_area(self): from geojson.feature import FeatureCollection from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(public=True, none_area=True) request = self._get_request(layer_id) layers = Layers(request) collection = layers.read_many() self.assertTrue(isinstance(collection, FeatureCollection)) self.assertEquals( [f.properties["child"] for f in collection.features], [u"c1é", u"c2é"], )
def test_read_one_none_area(self): from geojson.feature import Feature from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(none_area=True) request = self._get_request(layer_id, username=u'__test_user') request.matchdict['feature_id'] = 1 layers = Layers(request) feature = layers.read_one() self.assertTrue(isinstance(feature, Feature)) self.assertEquals(feature.id, 1) self.assertEquals(feature.properties['name'], 'foo') self.assertEquals(feature.properties['child'], u'c1é')
def test_metadata_log(self): from c2cgeoportal.views.layers import Layers from c2cgeoportal.models import Metadata metadatas = [ Metadata("lastUpdateDateColumn", "last_update_date"), Metadata("lastUpdateUserColumn", "last_update_user"), ] layer_id = self._create_layer(metadatas=metadatas) request = self._get_request(layer_id, username=u"__test_user") layers = Layers(request) cls = layers.metadata() self.assertFalse(hasattr(cls, "last_update_date")) self.assertFalse(hasattr(cls, "last_update_user"))
def test_create_no_validation(self): from geojson.feature import FeatureCollection from c2cgeoportal.views.layers import Layers from c2cgeoportal.models import Metadata metadatas = [Metadata("geometryValidation", "False")] layer_id = self._create_layer(metadatas=metadatas, geom_type=False) request = self._get_request(layer_id, username="******") request.method = "POST" request.body = '{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"name": "foo", "child": "c1é"}, "geometry": {"type": "Point", "coordinates": [5, 45]}}, {"type": "Feature", "properties": {"text": "foo", "child": "c2é"}, "geometry": {"type": "LineString", "coordinates": [[5, 45], [5, 45]]}}]}' # noqa layers = Layers(request) collection = layers.create() self.assertEqual(request.response.status_int, 201) self.assertTrue(isinstance(collection, FeatureCollection)) self.assertEqual(len(collection.features), 2)
def test_update_no_validation(self): from c2cgeoportal.views.layers import Layers from c2cgeoportal.models import Metadata metadatas = [Metadata("geometryValidation", "False")] layer_id = self._create_layer(metadatas=metadatas, geom_type=False) request = self._get_request(layer_id, username="******") request.matchdict["feature_id"] = 1 request.method = "PUT" request.body = '{"type": "Feature", "id": 1, "properties": {"name": "foobar", "child": "c2é"}, "geometry": {"type": "LineString", "coordinates": [[5, 45], [5, 45]]}}' # noqa layers = Layers(request) feature = layers.update() self.assertEqual(feature.id, 1) self.assertEqual(feature.name, "foobar") self.assertEqual(feature.child, "c2é")
def test_create_no_validation(self): from geojson.feature import FeatureCollection from c2cgeoportal.views.layers import Layers from c2cgeoportal.models import Metadata metadatas = [ Metadata("geometry_validation", "False") ] layer_id = self._create_layer(metadatas=metadatas, geom_type=False) request = self._get_request(layer_id, username=u"__test_user") request.method = "POST" request.body = '{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"name": "foo", "child": "c1é"}, "geometry": {"type": "Point", "coordinates": [5, 45]}}, {"type": "Feature", "properties": {"text": "foo", "child": "c2é"}, "geometry": {"type": "LineString", "coordinates": [[5, 45], [5, 45]]}}]}' # noqa layers = Layers(request) collection = layers.create() self.assertEquals(request.response.status_int, 201) self.assertTrue(isinstance(collection, FeatureCollection)) self.assertEquals(len(collection.features), 2)
def test_update_no_validation(self): from c2cgeoportal.views.layers import Layers from c2cgeoportal.models import Metadata metadatas = [ Metadata("geometry_validation", "False") ] layer_id = self._create_layer(metadatas=metadatas, geom_type=False) request = self._get_request(layer_id, username=u"__test_user") request.matchdict["feature_id"] = 1 request.method = "PUT" request.body = '{"type": "Feature", "id": 1, "properties": {"name": "foobar", "child": "c2é"}, "geometry": {"type": "LineString", "coordinates": [[5, 45], [5, 45]]}}' # noqa layers = Layers(request) feature = layers.update() self.assertEquals(feature.id, 1) self.assertEquals(feature.name, "foobar") self.assertEquals(feature.child, u"c2é")
def test_read_many_layer_not_found(self): from pyramid.httpexceptions import HTTPNotFound from c2cgeoportal.views.layers import Layers self._create_layer() request = self._get_request(10000, username=u'__test_user') layers = Layers(request) self.assertRaises(HTTPNotFound, layers.read_many)
def test_read_many_multi(self): from geojson.feature import FeatureCollection from c2cgeoportal.views.layers import Layers layer_id1 = self._create_layer() layer_id2 = self._create_layer() layer_id3 = self._create_layer() layer_ids = "%d,%d,%d" % (layer_id1, layer_id2, layer_id3) request = self._get_request(layer_ids, username=u"__test_user") layers = Layers(request) collection = layers.read_many() self.assertTrue(isinstance(collection, FeatureCollection)) self.assertEquals( [f.properties["__layer_id__"] for f in collection.features], [layer_id1, layer_id2, layer_id3], )
def test_read_many_no_auth_none_area(self): from pyramid.httpexceptions import HTTPForbidden from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(none_area=True) request = self._get_request(layer_id) layers = Layers(request) self.assertRaises(HTTPForbidden, layers.read_many)
def test_metadata_no_auth(self): from pyramid.httpexceptions import HTTPForbidden from c2cgeoportal.views.layers import Layers layer_id = self._create_layer() request = self._get_request(layer_id) layers = Layers(request) self.assertRaises(HTTPForbidden, layers.metadata)
def test_enumerate_attribute_values_list(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(public=True, attr_list=True) tablename = "table_%d" % layer_id settings = { "layers": { "enum": { "layer_test": { "table": tablename, "attributes": { "label": { "column_name": "name", "separator": "," } } } } } } request = self._get_request(layer_id) request.registry.settings.update(settings) request.matchdict["layer_name"] = "layer_test" request.matchdict["field_name"] = "label" layers = Layers(request) response = layers.enumerate_attribute_values() self.assertEquals( response, { "items": [{ "label": u"aaa", "value": u"aaa" }, { "label": u"bar", "value": u"bar" }, { "label": u"bbb", "value": u"bbb" }, { "label": u"foo", "value": u"foo" }] })
def test_delete_no_auth_none_area(self): from pyramid.httpexceptions import HTTPForbidden from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(none_area=True) request = self._get_request(layer_id) request.matchdict['feature_id'] = 2 request.method = 'DELETE' layers = Layers(request) self.assertRaises(HTTPForbidden, layers.delete)
def test_update_log(self): from datetime import datetime from c2cgeoportal.views.layers import Layers from c2cgeoportal.models import Metadata metadatas = [ Metadata("lastUpdateDateColumn", "last_update_date"), Metadata("lastUpdateUserColumn", "last_update_user"), ] layer_id = self._create_layer(metadatas=metadatas) request = self._get_request(layer_id, username=u"__test_user") request.matchdict["feature_id"] = 1 request.method = "PUT" request.body = '{"type": "Feature", "id": 1, "properties": {"name": "foobar", "child": "c2é"}, "geometry": {"type": "Point", "coordinates": [5, 45]}}' # noqa layers = Layers(request) feature = layers.update() self.assertEquals(feature.id, 1) self.assertEquals(feature.last_update_user, request.user.id) self.assertIsInstance(feature.last_update_date, datetime)
def test_enumerate_attribute_values_list(self): from c2cgeoportal.views.layers import Layers layer_id = self._create_layer(public=True, attr_list=True) tablename = "table_%d" % layer_id settings = { 'layers_enum': { 'layer_test': { 'table': tablename, 'attributes': { 'label': { 'column_name': 'name', 'separator': ',' } } } } } request = self._get_request(layer_id) request.registry.settings.update(settings) request.matchdict['layer_name'] = 'layer_test' request.matchdict['field_name'] = 'label' layers = Layers(request) response = layers.enumerate_attribute_values() self.assertEquals(response, { 'items': [{ 'label': u'aaa', 'value': u'aaa' }, { 'label': u'bar', 'value': u'bar' }, { 'label': u'bbb', 'value': u'bbb' }, { 'label': u'foo', 'value': u'foo' }] })
def test_read_many_multi(self): from geojson.feature import FeatureCollection from c2cgeoportal.views.layers import Layers layer_id1 = self._create_layer() layer_id2 = self._create_layer() layer_id3 = self._create_layer() layer_ids = '%d,%d,%d' % (layer_id1, layer_id2, layer_id3) request = self._get_request(layer_ids, username=u'__test_user') layers = Layers(request) collection = layers.read_many() self.assertTrue(isinstance(collection, FeatureCollection)) self.assertEquals(len(collection.features), 3) self.assertEquals(collection.features[0].properties['__layer_id__'], layer_id1) self.assertEquals(collection.features[1].properties['__layer_id__'], layer_id2) self.assertEquals(collection.features[2].properties['__layer_id__'], layer_id3)
def test_create_log(self): from datetime import datetime from geojson.feature import FeatureCollection from c2cgeoportal.views.layers import Layers from c2cgeoportal.models import Metadata metadatas = [ Metadata("lastUpdateDateColumn", "last_update_date"), Metadata("lastUpdateUserColumn", "last_update_user"), ] layer_id = self._create_layer(metadatas=metadatas) request = self._get_request(layer_id, username=u"__test_user") request.method = "POST" request.body = '{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"name": "foo", "child": "c1é"}, "geometry": {"type": "Point", "coordinates": [5, 45]}}]}' # noqa layers = Layers(request) collection = layers.create() self.assertEquals(request.response.status_int, 201) self.assertTrue(isinstance(collection, FeatureCollection)) self.assertEquals(len(collection.features), 1) properties = collection.features[0] self.assertEquals(properties.last_update_user, request.user.id) self.assertIsInstance(properties.last_update_date, datetime)