Tests: populate settings from _umap_options when data is passed
This commit is contained in:
parent
35758a1e13
commit
3b304e5249
1 changed files with 11 additions and 6 deletions
|
@ -107,12 +107,17 @@ class DataLayerFactory(factory.django.DjangoModelFactory):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _adjust_kwargs(cls, **kwargs):
|
def _adjust_kwargs(cls, **kwargs):
|
||||||
data = kwargs.pop("data", copy.deepcopy(DATALAYER_DATA))
|
if "data" in kwargs:
|
||||||
kwargs["settings"]["name"] = kwargs["name"]
|
data = copy.deepcopy(kwargs.pop("data"))
|
||||||
data["_umap_options"] = {
|
if "settings" not in kwargs:
|
||||||
**DataLayerFactory.settings._defaults,
|
kwargs["settings"] = data.get("_umap_options", {})
|
||||||
**kwargs["settings"],
|
else:
|
||||||
}
|
data = DATALAYER_DATA.copy()
|
||||||
|
data["_umap_options"] = {
|
||||||
|
**DataLayerFactory.settings._defaults,
|
||||||
|
**kwargs["settings"],
|
||||||
|
}
|
||||||
|
data["_umap_options"]["name"] = kwargs["name"]
|
||||||
kwargs["geojson"] = ContentFile(json.dumps(data), "foo.json")
|
kwargs["geojson"] = ContentFile(json.dumps(data), "foo.json")
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue