Exemple #1
0
    def setUp(self) -> None:
        self.property_key = 'logo'
        self.feature_without_file_name = FeatureFactory(
            properties={
                self.property_key: 'data:image/png;base64,xxxxxxxxxxxxxxxxxxxxxxxxxx=='
            }
        )
        self.feature_without_file_data = FeatureFactory(
            properties={
                self.property_key: None
            }
        )
        self.crud_view = factories.CrudViewFactory(
            layer__schema={
                'properties': {
                    self.property_key: {
                        "type": "string",
                        "format": 'data-url',
                    }
                }
            }
        )

        self.feature_with_file_name = FeatureFactory(
            layer=self.crud_view.layer,
            properties={
                self.property_key: 'data:image/png;name=toto.png;base64,xxxxxxxxxxxxxxxxxxxxxxxxxx=='
            }
        )
Exemple #2
0
 def setUp(self) -> None:
     self.crud_view = factories.CrudViewFactory(
         layer__schema={
             "type": "object",
             "required": [
                 "name",
             ],
             "properties": {
                 "name": {
                     'type': "string",
                     "title": "Name"
                 },
                 "logo": {
                     'type': "string",
                     "title": "Logo",
                     "format": "data-url"
                 },
                 "age": {
                     'type': "integer",
                     "title": "Age",
                 },
                 "country": {
                     'type': "string",
                     "title": "Country"
                 },
             }
         })
 def setUp(self) -> None:
     self.crud_view = factories.CrudViewFactory()
     models.CrudViewProperty.objects.create(view=self.crud_view,
                                            key="date_start",
                                            required=True,
                                            json_schema={
                                                'type': "string",
                                                "title": "Date start",
                                                "format": "date"
                                            })
     models.CrudViewProperty.objects.create(view=self.crud_view,
                                            key="date_end",
                                            required=True,
                                            json_schema={
                                                'type': "string",
                                                "title": "Date end",
                                                "format": "date"
                                            })
     self.feature = Feature.objects.create(geom='POINT(0 0)',
                                           properties={
                                               "date_start": "test",
                                               "date_end": "2020-12-10"
                                           },
                                           layer=self.crud_view.layer)
     sync_layer_schema(self.crud_view)
     sync_ui_schema(self.crud_view)
     self.serializer = CrudFeatureDetailSerializer(self.feature)
Exemple #4
0
    def setUp(self) -> None:
        self.property_key = 'logo'
        self.feature_without_file_name = FeatureFactory(
            properties={
                self.property_key: 'data:image/png;base64,xxxxxxxxxxxxxxxxxxxxxxxxxx=='
            }
        )
        self.feature_without_file_data = FeatureFactory(
            properties={
                self.property_key: None
            }
        )
        self.crud_view = factories.CrudViewFactory(
            layer__schema={
                'properties': {
                    self.property_key: {
                        "type": "string",
                        "format": 'data-url',
                    }
                }
            }
        )

        self.feature_with_file_name = FeatureFactory(
            layer=self.crud_view.layer,
            properties={
                self.property_key: 'data:image/png;name=toto.png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkqAcAAIUAgUW0RjgAAAAASUVORK5CYII='
            }
        )
Exemple #5
0
 def setUpTestData(cls):
     cls.crud_view = factories.CrudViewFactory()
     cls.prop_1 = CrudViewProperty.objects.create(view=cls.crud_view,
                                                  key="age",
                                                  json_schema={
                                                      'type': "integer",
                                                      "title": "Age"
                                                  })
     cls.prop_2 = CrudViewProperty.objects.create(view=cls.crud_view,
                                                  key="height",
                                                  json_schema={
                                                      'type': "number",
                                                      "title": "Height"
                                                  })
Exemple #6
0
 def setUp(self) -> None:
     self.crud_view = factories.CrudViewFactory()
     self.prop_1 = CrudViewProperty.objects.create(
         view=self.crud_view,
         key="name",
         json_schema={
             'type': "string",
             "title": "Name"
         },
         ui_schema={'title': 'Real name'})
     self.prop_2 = CrudViewProperty.objects.create(view=self.crud_view,
                                                   key="age",
                                                   json_schema={
                                                       'type': "integer",
                                                       "title": "Age"
                                                   })
     self.prop_3 = CrudViewProperty.objects.create(
         view=self.crud_view, key="country", json_schema={'type': "string"})
Exemple #7
0
 def setUp(self) -> None:
     self.crud_view = factories.CrudViewFactory()
     self.group_1 = models.FeaturePropertyDisplayGroup.objects.create(
         crud_view=self.crud_view, label='test')
     self.group_2 = models.FeaturePropertyDisplayGroup.objects.create(
         crud_view=self.crud_view, label='test2')
     CrudViewProperty.objects.create(view=self.crud_view,
                                     key="name",
                                     group=self.group_2,
                                     required=True,
                                     json_schema={
                                         'type': "string",
                                         "title": "Name"
                                     },
                                     ui_schema={'ui:widget': 'textarea'})
     CrudViewProperty.objects.create(view=self.crud_view,
                                     key="age",
                                     group=self.group_1,
                                     json_schema={
                                         'type': "integer",
                                         "title": "Age"
                                     })
     CrudViewProperty.objects.create(view=self.crud_view,
                                     key="country",
                                     json_schema={
                                         'type': "string",
                                         "title": "Country"
                                     })
     self.feature = Feature.objects.create(geom=Point(0, 0, srid=4326),
                                           properties={
                                               "age": 10,
                                               "name": "jec",
                                               "country": "slovenija"
                                           },
                                           layer=self.crud_view.layer)
     self.template = factories.TemplateDocxFactory()
     self.crud_view.templates.add(self.template)
     sync_layer_schema(self.crud_view)
     sync_ui_schema(self.crud_view)
Exemple #8
0
 def setUp(self) -> None:
     self.crud_view = factories.CrudViewFactory()
     models.CrudViewProperty.objects.create(view=self.crud_view,
                                            key="date_start",
                                            required=True,
                                            json_schema={
                                                'type': "string",
                                                "title": "Date start",
                                                "format": "date"
                                            })
     models.CrudViewProperty.objects.create(view=self.crud_view,
                                            key="date_end",
                                            required=True,
                                            json_schema={
                                                'type': "string",
                                                "title": "Date end",
                                                "format": "date"
                                            })
     models.CrudViewProperty.objects.create(
         view=self.crud_view,
         key="not_editable",
         required=False,
         editable=False,
         json_schema={
             'type': "string",
             "title": "Not editable",
         },
     )
     prop_with_values = models.CrudViewProperty.objects.create(
         view=self.crud_view,
         key="type",
         required=False,
         editable=False,
         json_schema={
             'type': "string",
             "title": "Type",
         },
     )
     prop_with_array_values = models.CrudViewProperty.objects.create(
         view=self.crud_view,
         key="types",
         required=False,
         editable=False,
         json_schema={
             "type": "array",
             "items": {
                 "type": "string",
                 "enum": ['multi_type_3', 'multi_type_4']
             },
             "title": "Types"
         })
     PropertyEnum.objects.create(value='type_1',
                                 pictogram=ContentFile(SMALL_PICTURE,
                                                       name='test.png'),
                                 property=prop_with_values)
     PropertyEnum.objects.create(value='multi_type_1',
                                 pictogram=ContentFile(SMALL_PICTURE,
                                                       name='test.png'),
                                 property=prop_with_array_values)
     PropertyEnum.objects.create(value='multi_type_2',
                                 pictogram=ContentFile(SMALL_PICTURE,
                                                       name='test.png'),
                                 property=prop_with_array_values)
     PropertyEnum.objects.create(value='multi_type_5',
                                 property=prop_with_array_values)
     self.feature = Feature.objects.create(geom='POINT(0 0)',
                                           properties={
                                               "date_start":
                                               "test",
                                               "date_end":
                                               "2020-12-10",
                                               "type":
                                               "type_1",
                                               "types": [
                                                   'multi_type_1',
                                                   'multi_type_2',
                                                   'multi_type_3',
                                                   'multi_type_4',
                                                   'multi_type_5'
                                               ]
                                           },
                                           layer=self.crud_view.layer)
     sync_layer_schema(self.crud_view)
     sync_ui_schema(self.crud_view)
     self.serializer = CrudFeatureDetailSerializer(self.feature)
Exemple #9
0
 def setUpTestData(cls):
     cls.crud_view = factories.CrudViewFactory()
     sync_layer_schema(cls.crud_view)
     sync_ui_schema(cls.crud_view)
Exemple #10
0
 def setUpTestData(cls):
     cls.layer = LayerFactory(routable=True)
     cls.crud_view = factories.CrudViewFactory()
     cls.other_crud_view = factories.CrudViewFactory()
Exemple #11
0
 def setUp(self) -> None:
     self.crud_view = factories.CrudViewFactory()
     self.feature = Feature.objects.create(layer=self.crud_view.layer,
                                           geom='POINT(0 0)')
     self.attachment = FeatureAttachmentFactory(feature=self.feature)
Exemple #12
0
 def setUp(self) -> None:
     self.crud_view = factories.CrudViewFactory()
     self.feature = Feature.objects.create(layer=self.crud_view.layer,
                                           geom='POINT(0 0)')
     self.pic = FeaturePictureFactory(feature=self.feature)