def test_spatial_relationship_invalid_attribute(self): project = ProjectFactory.create(name='TestProject') QuestionnaireFactory.create(project=project) content_type = ContentType.objects.get(app_label='spatial', model='spatialrelationship') create_attrs_schema(project=project, dict=location_relationship_xform_group, content_type=content_type, errors=[]) assert 1 == Schema.objects.all().count() with pytest.raises(KeyError): SpatialRelationshipFactory.create(project=project, attributes={ 'invalid_attribute': 'yes', })
def test_spatial_relationship_invalid_attribute(self): project = ProjectFactory.create(name='TestProject') QuestionnaireFactory.create(project=project) content_type = ContentType.objects.get( app_label='spatial', model='spatialrelationship') create_attrs_schema( project=project, dict=location_relationship_xform_group, content_type=content_type, errors=[]) assert 1 == Schema.objects.all().count() with pytest.raises(KeyError): SpatialRelationshipFactory.create( project=project, attributes={ 'invalid_attribute': 'yes', } )
def test_spatial_relationship_schema(self): project = ProjectFactory.create(name='TestProject') QuestionnaireFactory.create(project=project) content_type = ContentType.objects.get( app_label='spatial', model='spatialrelationship') create_attrs_schema( project=project, dict=location_relationship_xform_group, content_type=content_type, errors=[]) sur = SpatialRelationshipFactory.create( project=project, attributes={ 'notes': 'Some additional textual info'} ) assert 1 == Schema.objects.all().count() schema = Schema.objects.get(content_type=content_type) assert schema is not None assert schema.selectors == [ project.organization.pk, project.pk, project.current_questionnaire] assert 'notes' in sur.attributes.attributes
def test_spatial_relationship_schema(self): project = ProjectFactory.create(name='TestProject') QuestionnaireFactory.create(project=project) content_type = ContentType.objects.get( app_label='spatial', model='spatialrelationship') create_attrs_schema( project=project, dict=location_relationship_xform_group, content_type=content_type, errors=[]) sur = SpatialRelationshipFactory.create( project=project, attributes={ 'notes': 'Some additional textual info'} ) assert 1 == Schema.objects.all().count() schema = Schema.objects.get(content_type=content_type) assert schema is not None assert schema.selectors == [ project.organization.pk, project.pk, project.current_questionnaire] assert 'notes' in sur.attributes.attributes