# Path: tests/base.py
# class APITestCase(APITestCase):
#     client_class = APIClient
# 
# Path: tests/rest_app/models.py
# class SlugModel(LabelModel):
#     code = models.SlugField()
#     name = models.CharField(max_length=255)
# 
# class FieldsetModel(LabelModel):
#     # General
#     name = models.CharField(max_length=50)
#     title = models.CharField(max_length=20)
# 
#     # Address
#     address = models.CharField(max_length=255)
#     city = models.CharField(max_length=255)
# 
# Path: tests/gis_app/models.py
# class GeometryModel(LabelModel):
#     name = models.CharField(max_length=255)
#     geometry = models.GeometryField(srid=settings.SRID)


import unittest
import json
from .base import APITestCase
from rest_framework import status
from tests.rest_app.models import SlugModel, FieldsetModel
from tests.gis_app.models import GeometryModel
from django.contrib.auth.models import User
from django.conf import settings
        # Test for expected response
        response = self.client.post('/geometrymodels.json', form)
        self.assertEqual(
            response.status_code, status.HTTP_201_CREATED, response.data
        )

        # Double-check ORM model & geometry attribute
        obj = GeometryModel.objects.get(id=response.data['id'])
        geom = obj.geometry
        self.assertEqual(geom.srid, 4326)
        self.assertEqual(geom.x, -90)
        self.assertEqual(geom.y, 44)

    @unittest.skipUnless(settings.WITH_GIS, "requires GIS")
    def test_rest_geometry_post_wkt(self):
        """
        Posting WKT to a model with a geometry field should work.
        """
        form = {
            'name': "Geometry Test 2",
            'geometry': "POINT(%s %s)" % (-97, 50)
        }

        # Test for expected response
        response = self.client.post('/geometrymodels.json', form)
        self.assertEqual(
            response.status_code, status.HTTP_201_CREATED, response.data
        )

        # Double-check ORM model & geometry attribute

# Path: tests/base.py
# class APITestCase(APITestCase):
#     client_class = APIClient
# 
# Path: tests/rest_app/models.py
# class SlugModel(LabelModel):
#     code = models.SlugField()
#     name = models.CharField(max_length=255)
# 
# class FieldsetModel(LabelModel):
#     # General
#     name = models.CharField(max_length=50)
#     title = models.CharField(max_length=20)
# 
#     # Address
#     address = models.CharField(max_length=255)
#     city = models.CharField(max_length=255)
# 
# Path: tests/gis_app/models.py
# class GeometryModel(LabelModel):
#     name = models.CharField(max_length=255)
#     geometry = models.GeometryField(srid=settings.SRID)


# Path: tests/test_post.py
import unittest
import json
from .base import APITestCase
from rest_framework import status
from tests.rest_app.models import SlugModel, FieldsetModel
from tests.gis_app.models import GeometryModel
from django.contrib.auth.models import User
from django.conf import settings

        # Test for expected response
        response = self.client.post('/geometrymodels.json', form)
        self.assertEqual(
            response.status_code, status.HTTP_201_CREATED, response.data
        )

        # Double-check ORM model & geometry attribute
        obj = GeometryModel.objects.get(id=response.data['id'])
        geom = obj.geometry
        self.assertEqual(geom.srid, 4326)
        self.assertEqual(geom.x, -90)
        self.assertEqual(geom.y, 44)

    @unittest.skipUnless(settings.WITH_GIS, "requires GIS")
    def test_rest_geometry_post_wkt(self):
        """
        Posting WKT to a model with a geometry field should work.
        """
        form = {
            'name': "Geometry Test 2",
            'geometry': "POINT(%s %s)" % (-97, 50)
        }

        # Test for expected response
        response = self.client.post('/geometrymodels.json', form)
        self.assertEqual(
            response.status_code, status.HTTP_201_CREATED, response.data
        )

        # Double-check ORM model & geometry attribute

        obj = GeometryModel.objects.get(id=response.data['id'])