I'm working on writing tests for a new GeoDjango project I've started. Normally I used Factory Boy and Faker to create model instances for testing. However it's not clear to me how you can mock GeoDjango PointField fields. When looking at the record in Spacialite it appears as a binary blob.
I'm totally new to GIS stuff, and a little confused as to how I can create factories for PointFields in Django.
# models.py
from django.contrib.gis.db import models
class Place(models.Model):
name = models.CharField(max_length=255)
location = models.PointField(blank=True, null=True)
objects = models.GeoManager()
def __str__(self):
return "%s" % self.name
# factories.py
import factory
from faker import Factory as FakerFactory
from . import models
faker = FakerFactory.create()
class PlaceFactory(factory.django.DjangoModelFactory):
class Meta:
model = models.Place
name = factory.LazyAttribute(lambda x: faker.name())
#location = What do I do?