def test_sum_points(geometry_record, test, method, geometry_types): theme = ThemeRecord('code', dict(), 100) real_estate_record = RealEstateRecord( 'test_type', 'BL', 'Nusshof', 1, 100, loads('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))')) geometry_record.calculate(real_estate_record, 0.1, 0.1, 'm', 'm2', geometry_types) plr_record = PlrRecord(theme, LegendEntryRecord(ImageRecord('1'.encode('utf-8')), {'en': 'Content'}, 'CodeA', None, theme, view_service_id=1), law_status, date.today() + timedelta(days=0), date.today() + timedelta(days=2), OfficeRecord({'en': 'Office'}), ImageRecord('1'.encode('utf-8')), ViewServiceRecord({'de': 'http://my.wms.com'}, 1, 1.0, 'de', 2056, None, None), [geometry_record], documents=[]) assert getattr(plr_record, method)() == test
def test_sub_theme(DummyRenderInfo, xml_templates, pyramid_oereb_test_config): template = xml_templates.get_template('public_law_restriction.xml') parameters = Parameter(response_format='xml', with_geometry=False, images=True, signed=False, identdn='BL0200002829', number='1000', egrid='CH775979211712', language='de') renderer = Renderer(DummyRenderInfo()) renderer._language = u'de' renderer._request = MockRequest() renderer._request.route_url = lambda url, **kwargs: "http://example.com/current/view" theme = ThemeRecord(u'ch.Nutzungsplanung', {'de': 'Theme 1'}, 1) subtheme = ThemeRecord(u'ch.Nutzungsplanung', {'de': 'sub-Theme 1'}, 2, u'ch.NutzungsplanungSubCode') office = OfficeRecord(name={'de': 'office de'}) law_status = LawStatusRecord(code='AenderungMitVorwirkung', title={'de': 'law status de'}) geometry = GeometryRecord(law_status, datetime.now(), datetime.now(), Polygon(), 'test') public_law_restriction = PlrRecord( theme=theme, legend_entry=LegendEntryRecord(ImageRecord('1'.encode('utf-8')), {'de': 'information de'}, 'CodeA', None, theme, view_service_id=1), law_status=law_status, published_from=datetime.now(), published_until=None, responsible_office=office, symbol=ImageRecord('1'.encode('utf-8')), view_service=ViewServiceRecord( { 'de': 'http://example.com?SERVICE=WMS&REQUEST=GetMap&FORMAT=image/png&SRS=epsg:2056' }, 1, 1.0, 'de', 2056, None, None), geometries=[geometry], sub_theme=subtheme) content = template.render( **{ 'params': parameters, 'localized': renderer.get_localized_text, 'multilingual': renderer.get_multilingual_text, 'get_localized_image': renderer.get_localized_image, 'public_law_restriction': public_law_restriction }).decode('utf-8').split('\n') no_empty_lines = list(filter(lambda line: line != '', content)) no_empty_lines = [no_space.strip() for no_space in no_empty_lines] # assert '<data:SubTheme>' in no_empty_lines # schema has changed: no subThemes any longer ??? assert '<data:Text>sub-Theme 1</data:Text>' in no_empty_lines assert '<data:SubCode>ch.NutzungsplanungSubCode</data:SubCode>' in no_empty_lines assert '<data:Code>ch.Nutzungsplanung</data:Code>' in no_empty_lines assert len(no_empty_lines) == 74
def test_published(published_from, published_until, published): theme = ThemeRecord('code', dict(), 100) plr_record = PlrRecord( theme, LegendEntryRecord(ImageRecord('1'.encode('utf-8')), {'en': 'Content'}, 'CodeA', None, theme, view_service_id=1), law_status, published_from, published_until, OfficeRecord({'en': 'Office'}), ImageRecord('1'.encode('utf-8')), ViewServiceRecord({'de': 'http://my.wms.com'}, 1, 1.0, 'de', 2056, None, None), [GeometryRecord(law_status, datetime.date.today(), None, Point(1, 1))]) assert plr_record.published == published
def create_dummy_plr(): office = OfficeRecord({'en': 'Office'}) view_service = ViewServiceRecord({'de': 'http://my.wms.com'}, 1, 1.0, 'de', 2056, None, None) geometry = GeometryRecord(law_status, datetime.date.today(), None, Point(1, 1)) record = PlrRecord( ThemeRecord('code', dict(), 100), LegendEntryRecord(ImageRecord('1'.encode('utf-8')), {'en': 'Content'}, 'CodeA', None, ThemeRecord('code', dict(), 100), view_service_id=1), law_status, datetime.date(1985, 8, 29), None, office, ImageRecord('1'.encode('utf-8')), view_service, [geometry]) return record
def test_wrong_legend_entry_text_type(): theme = ThemeRecord('code', dict(), 100) plr_record = PlrRecord( theme, LegendEntryRecord(ImageRecord('1'.encode('utf-8')), 'legendentry', 'CodeA', None, theme, view_service_id=1), law_status, date.today() + timedelta(days=0), date.today() + timedelta(days=2), OfficeRecord({'en': 'Office'}), ImageRecord('1'.encode('utf-8')), ViewServiceRecord({'de': 'http://my.wms.com'}, 1, 1.0, 'de', 2056, None, None), [GeometryRecord(law_status, datetime.date.today(), None, Point(1, 1))]) assert isinstance(plr_record.legend_entry, LegendEntryRecord)
def test_serialization(): theme = ThemeRecord('code', dict(), 100) plr_record = PlrRecord( theme, LegendEntryRecord(ImageRecord('1'.encode('utf-8')), {'en': 'Content'}, 'CodeA', None, theme, view_service_id=1), law_status, date.today() + timedelta(days=0), date.today() + timedelta(days=2), OfficeRecord({'en': 'Office'}), ImageRecord('1'.encode('utf-8')), ViewServiceRecord({'de': 'http://my.wms.com'}, 1, 1.0, 'de', 2056, None, None), [GeometryRecord(law_status, datetime.date.today(), None, Point(1, 1))], documents=[]) assert isinstance(str(plr_record), str)
def from_db_to_plr_record(self, params, public_law_restriction_from_db, legend_entries_from_db): thresholds = self._plr_info.get('thresholds') min_length = thresholds.get('length').get('limit') length_unit = thresholds.get('length').get('unit') min_area = thresholds.get('area').get('limit') area_unit = thresholds.get('area').get('unit') legend_entry_record = self.from_db_to_legend_entry_record( public_law_restriction_from_db.legend_entry) legend_entry_records = self.from_db_to_legend_entry_records( legend_entries_from_db, legend_entry_record.theme.sub_code) symbol = ImageRecord( b64.decode( binascii.b2a_base64( public_law_restriction_from_db.legend_entry.symbol).decode( 'ascii'))) view_service_record = self.from_db_to_view_service_record( public_law_restriction_from_db.view_service, legend_entry_records, self._plr_info.get('code')) theme = Config.get_theme_by_code_sub_code( public_law_restriction_from_db.legend_entry.theme, public_law_restriction_from_db.legend_entry.sub_theme) document_records = eliminate_duplicated_document_records( theme.document_records, self.get_document_records(params, public_law_restriction_from_db)) geometry_records = self.from_db_to_geometry_records( public_law_restriction_from_db.geometries) law_status = Config.get_law_status_by_data_code( self._plr_info.get('code'), public_law_restriction_from_db.law_status) sub_theme_legend_entry_record = \ legend_entry_record.theme if legend_entry_record.theme.sub_code else None plr_record = self._plr_record_class( Config.get_theme_by_code_sub_code(legend_entry_record.theme.code), legend_entry_record, law_status, public_law_restriction_from_db.published_from, public_law_restriction_from_db.published_until, self.from_db_to_office_record( public_law_restriction_from_db.responsible_office), symbol, view_service_record, geometry_records, sub_theme=sub_theme_legend_entry_record, type_code=public_law_restriction_from_db.legend_entry.type_code, type_code_list=public_law_restriction_from_db.legend_entry. type_code_list, documents=document_records, min_area=min_area, min_length=min_length, area_unit=area_unit, length_unit=length_unit, view_service_id=public_law_restriction_from_db.view_service.t_id) return plr_record
def test_get_symbol_ref(pyramid_test_config): record = LegendEntryRecord(ImageRecord( FileAdapter().read('tests/resources/logo_canton.png')), {'de': 'Test'}, 'CodeA', 'http://my.codelist.com/test.xml', ThemeRecord('ch.BelasteteStandorte', {'de': 'Belastete Standorte'}, 410), view_service_id='1') request = DummyRequest() url = urlparse(get_symbol_ref(request, record)) assert url.path == '/image/symbol/ch.BelasteteStandorte/1/CodeA.png'
def __init__(self, code, image_dict): if not isinstance(code, str): warnings.warn('Type of "code" should be "str"') if not isinstance(image_dict, dict): warnings.warn('Type of "image_dict" should be "dict"') self.code = code self.image_dict = {} for key in image_dict.keys(): self.image_dict[key] = ImageRecord(b64.decode(image_dict[key]))
def from_db_to_legend_entry_record(self, legend_entry_from_db): theme = Config.get_theme_by_code_sub_code( legend_entry_from_db.theme, legend_entry_from_db.sub_theme) legend_entry_record = self._legend_entry_record_class( ImageRecord(b64.decode(legend_entry_from_db.symbol)), legend_entry_from_db.legend_text, legend_entry_from_db.type_code, legend_entry_from_db.type_code_list, theme, view_service_id=legend_entry_from_db.view_service_id, ) return legend_entry_record
def test_init(): record = LegendEntryRecord(ImageRecord('100'.encode('utf-8')), {'de': 'test'}, 'test_code', 'test', ThemeRecord('test', {'de': 'Test'}, 100), view_service_id=1) assert isinstance(record.symbol, ImageRecord) assert isinstance(record.legend_text, dict) assert isinstance(record.type_code, str) assert isinstance(record.type_code_list, str) assert isinstance(record.theme, ThemeRecord) assert record.legend_text == {'de': 'test'}
def get_symbol(request): """ Returns the symbol for the requested theme and type code from database. Args: request (pyramid.request.Request): The request containing the codes as matchdict parameters. Returns: pyramid.response.Response: The generated response object. """ theme_code = request.matchdict.get('theme_code') view_service_id = request.matchdict.get('view_service_id') type_code = request.matchdict.get('type_code') plr = None for p in Config.get('plrs'): if str(p.get('code')).lower() == str(theme_code).lower(): plr = p break if plr is None: raise HTTPNotFound('No theme with code {}.'.format(theme_code)) session = database_adapter.get_session( plr.get('source').get('params').get('db_connection')) try: config_parser = StandardThemeConfigParser(**plr) models = config_parser.get_models() model = models.LegendEntry legend_entry = session.query(model).filter( cast(model.type_code, Text) == cast(type_code, Text)).filter( model.view_service_id == view_service_id).first() if legend_entry: symbol = getattr(legend_entry, 'symbol', None) if symbol: response = request.response response.status_int = 200 if isinstance(symbol, str): response.body = b64.decode(symbol) if isinstance(symbol, bytes): response.body = b64.decode( binascii.b2a_base64(symbol).decode('ascii')) response.content_type = ImageRecord.get_mimetype( bytearray(response.body)) return response raise HTTPNotFound() finally: session.close()
def test_format_legend_entry(DummyRenderInfo, parameter): renderer = Renderer(DummyRenderInfo()) renderer._language = u'de' renderer._params = parameter renderer._request = MockRequest() theme = ThemeRecord(u'ch.BelasteteStandorte', {u'de': u'Test'}, 410) legend_entry = LegendEntryRecord(ImageRecord( FileAdapter().read('tests/resources/python.svg')), {u'de': u'Legendeneintrag'}, u'CodeA', u'type_code_list', theme, view_service_id=1) result = renderer.format_legend_entry(legend_entry) expected = { 'LegendText': renderer.get_multilingual_text({'de': 'Legendeneintrag'}), 'TypeCode': 'CodeA', 'TypeCodelist': 'type_code_list', 'Theme': renderer.format_theme(theme), } if parameter.images: expected.update({ 'Symbol': ImageRecord( FileAdapter().read('tests/resources/python.svg')).encode() }) else: expected.update({ 'SymbolRef': 'http://example.com/image/symbol/{theme_code}/{view_service_id}/{code}.svg' .format(theme_code='ch.BelasteteStandorte', view_service_id=1, code='CodeA') }) assert isinstance(result, dict) assert result == expected
def test_get_symbol_ref(theme_code, pyramid_test_config, pyramid_oereb_test_config): request = MockRequest() record = LegendEntryRecord(ImageRecord( FileAdapter().read('tests/resources/python.svg')), {'de': 'Test'}, u'test', u'test', ThemeRecord(theme_code, {'de': 'Test'}, 100), view_service_id=1) if theme_code == u'NotExistingTheme': with pytest.raises(HTTPServerError): Base.get_symbol_ref(request, record) else: ref = Base.get_symbol_ref(request, record) assert ref == 'http://example.com/image/symbol/{}/{}/{}.svg'.format( theme_code, record.view_service_id, record.type_code)
def download_wms_content(self, language): """ Downloads the image found behind the URL stored in the instance attribute "reference_wms" for the requested language Args: language (string): the language for which the image should be downloaded Raises: LookupError: Raised if the response is not code 200 or content-type doesn't contains type "image". AttributeError: Raised if the URL itself isn't valid at all. """ main_msg = "Image for WMS couldn't be retrieved." if language not in self.reference_wms: msg = f"No WMS reference found for the requested language ({language}), using default language" log.info(msg) language = self.default_language wms = self.reference_wms.get(language) if uri_validator(wms): log.debug(f"Downloading image, url: {wms}") try: response = requests.get(wms, proxies=self.proxies) except Exception as ex: dedicated_msg = f"An image could not be downloaded. URL was: {wms}, error was {ex}" log.error(dedicated_msg) raise LookupError(dedicated_msg) content_type = response.headers.get('content-type', '') if response.status_code == 200 and content_type.find('image') > -1: self.image[language] = ImageRecord(response.content) else: dedicated_msg = f"The image could not be downloaded. URL was: {wms}, " \ f"Response was {response.content.decode('utf-8')}" log.error(main_msg) log.error(dedicated_msg) raise LookupError(dedicated_msg) else: dedicated_msg = f"URL seems to be not valid. URL was: {wms}" log.error(main_msg) log.error(dedicated_msg) raise AttributeError(dedicated_msg)
def test_init_with_relation(pyramid_oereb_test_config): legend_entry_record = LegendEntryRecord(ImageRecord('100'.encode('utf-8')), {'en': 'test'}, 'test_code', 'test', ThemeRecord( 'test', {'de': 'Test'}, 100), view_service_id=1) legend_records = [legend_entry_record] record = ViewServiceRecord({'de': 'http://www.test.url.ch'}, 1, 1.0, 'de', 2056, None, legend_records) assert isinstance(record.reference_wms, dict) assert isinstance(record.layer_index, int) assert isinstance(record.layer_opacity, float) assert record.default_language == 'de' assert record.srid == 2056 assert record.proxies is None assert len(record.legends) == 1 assert record.legends[0] == legend_entry_record
def from_db_to_legend_entry_record(self, legend_entry_from_db): theme = Config.get_theme_by_code_sub_code( legend_entry_from_db.theme, legend_entry_from_db.sub_theme) legend_entry_record = self._legend_entry_record_class( ImageRecord( b64.decode( binascii.b2a_base64( legend_entry_from_db.symbol).decode('ascii'))), from_multilingual_text_to_dict( de=legend_entry_from_db.legend_text_de, fr=legend_entry_from_db.legend_text_fr, it=legend_entry_from_db.legend_text_it, rm=legend_entry_from_db.legend_text_rm, en=legend_entry_from_db.legend_text_en), legend_entry_from_db.type_code, legend_entry_from_db.type_code_list, theme, view_service_id=legend_entry_from_db.view_service_id, ) return legend_entry_record
def test_sub_theme(DummyRenderInfo, xml_templates, pyramid_oereb_test_config): template = xml_templates.get_template('legend_entry.xml') parameters = Parameter(response_format='xml', with_geometry=False, images=True, signed=False, identdn='BL0200002829', number='1000', egrid='CH775979211712', language='de') renderer = Renderer(DummyRenderInfo()) renderer._language = u'de' renderer._request = MockRequest() renderer._request.route_url = lambda url, **kwargs: "http://example.com/current/view" legend_entry = LegendEntryRecord( symbol=ImageRecord('1'.encode('utf-8')), legend_text={'de': 'legend1'}, type_code='ch.Nutzungsplanung', type_code_list='bla', theme=ThemeRecord(u'ch.Nutzungsplanung', {'de': 'Theme 1 with sub-theme'}, 20, u'ch.NutzungsplanungSubCode'), ) content = template.render( **{ 'params': parameters, 'localized': renderer.get_localized_text, 'multilingual': renderer.get_multilingual_text, 'legend_entry': legend_entry }).decode('utf-8').split('\n') no_empty_lines = list(filter(lambda line: line != '', content)) no_empty_lines = [no_space.strip() for no_space in no_empty_lines] assert '<data:Text>Theme 1 with sub-theme</data:Text>' in no_empty_lines assert '<data:SubCode>ch.NutzungsplanungSubCode</data:SubCode>' in no_empty_lines assert '<data:Code>ch.Nutzungsplanung</data:Code>' in no_empty_lines assert len(no_empty_lines) == 22
def test_format_plr(DummyRenderInfo, parameter): renderer = Renderer(DummyRenderInfo()) renderer._language = 'de' renderer._params = parameter renderer._request = MockRequest() document = DocumentRecord(document_type=DocumentTypeRecord( 'GesetzlicheGrundlage', {'de': 'Gesetzliche Grundlage'}), index=1, law_status=law_status(), published_from=datetime.date.today(), title={u'de': u'Test Dokument'}, responsible_office=OfficeRecord({u'de': u'BUD'}), text_at_web={'de': 'http://mein.dokument.ch'}) documents = [document] theme = ThemeRecord(u'ch.BelasteteStandorte', {u'de': u'Test theme'}, 410) subTheme = None # subTheme = ThemeRecord( # u'ch.BelasteteStandorte', # {u'de': u'SubTheme'}, 411, u'SubCodech.BelasteteStandorte' # ) office = OfficeRecord({'de': 'Test Office'}) legend_entry = LegendEntryRecord(ImageRecord( FileAdapter().read('tests/resources/python.svg')), {'de': 'Test'}, 'CodeA', 'TypeCodeList', theme, view_service_id=1) view_service = ViewServiceRecord({'de': 'http://geowms.bl.ch'}, 1, 1.0, 'de', 2056, None, [legend_entry]) geometry = GeometryRecord(law_status(), datetime.date.today(), None, Point(1, 1)) plr = PlrRecord(theme, legend_entry, law_status(), datetime.date.today(), None, office, ImageRecord( FileAdapter().read('tests/resources/python.svg')), view_service, [geometry], subTheme, type_code='CodeA', type_code_list='TypeCodeList', documents=documents, view_service_id=1) plr.part_in_percent = 0.5 result = renderer.format_plr([plr]) assert isinstance(result, list) assert len(result) == 1 assert isinstance(result[0], dict) expected = { 'LegendText': renderer.get_multilingual_text(plr.legend_text), 'Theme': renderer.format_theme(plr.theme), 'Lawstatus': { 'Code': 'inKraft', 'Text': [{ 'Language': 'de', 'Text': 'Rechtskräftig' }] }, 'ResponsibleOffice': renderer.format_office(plr.responsible_office), 'Map': renderer.format_map(plr.view_service), 'TypeCode': 'CodeA', 'TypeCodelist': 'TypeCodeList', 'LegalProvisions': [renderer.format_document(document)], 'PartInPercent': 0.5 } if parameter.images: expected.update({ 'Symbol': ImageRecord( FileAdapter().read('tests/resources/python.svg')).encode() }) else: result = renderer.format_plr([plr]) assert isinstance(result, list) assert len(result) == 1 assert isinstance(result[0], dict) expected = { 'LegendText': renderer.get_multilingual_text(plr.legend_text), 'Theme': renderer.format_theme(plr.theme), 'Lawstatus': { 'Code': 'inKraft', 'Text': [{ 'Language': 'de', 'Text': 'Rechtskräftig' }] }, 'ResponsibleOffice': renderer.format_office(plr.responsible_office), 'Map': renderer.format_map(plr.view_service), 'TypeCode': 'CodeA', 'TypeCodelist': 'TypeCodeList', 'LegalProvisions': [renderer.format_document(document)], 'PartInPercent': 0.5 } if parameter.images: expected.update({ 'Symbol': ImageRecord( FileAdapter().read('tests/resources/python.svg')).encode() }) else: expected.update({ 'SymbolRef': 'http://example.com/image/symbol/{theme}/{view_service_id}/{code}.svg' .format(theme='ch.BelasteteStandorte', view_service_id=1, code='CodeA') }) assert result[0] == expected
def test_init(): image_record = ImageRecord('1'.encode('utf-8')) assert isinstance(image_record.content, bytes)
def test_validate_filetype_invalid(): with pytest.raises(TypeError) as e: ImageRecord._validate_filetype('tests/resources/invalid.jpg') assert '{0}'.format(e.value).startswith('Invalid file type')
def test_validate_filetype_svg_content(): content = FileAdapter().read('tests/resources/python.svg') assert ImageRecord._validate_filetype(content) == ('svg', 'image/svg+xml')
def test_validate_filetype_svg_file(): assert ImageRecord._validate_filetype('tests/resources/python.svg') == ( 'svg', 'image/svg+xml')
def test_validate_filetype_png_content(): content = FileAdapter().read('tests/resources/logo_canton.png') assert ImageRecord._validate_filetype(content) == ('png', 'image/png')
def test_validate_filetype_png_file(): assert ImageRecord._validate_filetype( 'tests/resources/logo_canton.png') == ('png', 'image/png')
def test_validate_filetype_unrecognized(): with pytest.raises(TypeError) as e: ImageRecord._validate_filetype('tests/resources/test_config.yml') assert '{0}'.format(e.value) == 'Unrecognized file type'
def test_encode(): image_record = ImageRecord('1'.encode('utf-8')) assert image_record.encode() == b64.encode('1'.encode('utf-8'))
def test_processor_get_legend_entries(processor_data, real_estate_data): theme1 = ThemeRecord(u'TEST', {'de': 'Theme 1'}, 100) theme2 = ThemeRecord(u'TEST', {'de': 'Theme 2'}, 200) office = OfficeRecord({'de': 'Test Office'}) law_status = LawStatusRecord(u'inKraft', {u'de': u'Rechtskräftig'}) geometries = [GeometryRecord(law_status, datetime.date.today(), None, Point(1, 1))] legend1 = LegendEntryRecord( ImageRecord('1'.encode('utf-8')), {'de': 'legend1'}, 'CodeA', 'bla', theme1, view_service_id=1 ) legend2 = LegendEntryRecord( ImageRecord('1'.encode('utf-8')), {'de': 'legend2'}, 'CodeB', 'bla', theme1, view_service_id=1 ) legend3 = LegendEntryRecord( ImageRecord('1'.encode('utf-8')), {'de': 'legend3'}, 'CodeC', 'bla', theme2, view_service_id=1 ) legend4 = LegendEntryRecord( ImageRecord('1'.encode('utf-8')), {'de': 'legend4'}, 'CodeD', 'bla', theme2, view_service_id=1 ) view_service1 = ViewServiceRecord( {'de': 'http://www.test1.url.ch'}, 1, 1.0, 'de', 2056, None, legends=[legend1, legend2] ) view_service2 = ViewServiceRecord( {'de': 'http://www.test2.url.ch'}, 1, 1.0, 'de', 2056, None, legends=[legend3, legend4] ) image = ImageRecord('1'.encode('utf-8')) plr1 = PlrRecord( theme1, LegendEntryRecord( ImageRecord('1'.encode('utf-8')), {'de': 'CONTENT'}, 'CodeD', 'bla', theme1, view_service_id=1 ), law_status, datetime.datetime.now(), None, office, image, view_service1, geometries, type_code='CodeA', ) plr2 = PlrRecord( theme1, LegendEntryRecord( ImageRecord('1'.encode('utf-8')), {'de': 'CONTENT'}, 'CodeD', 'bla', theme1, view_service_id=1 ), law_status, datetime.datetime.now(), None, office, image, view_service1, geometries, type_code='CodeB' ) plr3 = PlrRecord( theme1, LegendEntryRecord( ImageRecord('1'.encode('utf-8')), {'de': 'CONTENT'}, 'CodeD', 'bla', theme1, view_service_id=1 ), law_status, datetime.datetime.now(), None, office, image, view_service2, geometries, type_code='CodeB' ) plr4 = PlrRecord( theme1, LegendEntryRecord( ImageRecord('1'.encode('utf-8')), {'de': 'CONTENT'}, 'CodeD', 'bla', theme1, view_service_id=1 ), law_status, datetime.datetime.now(), None, office, image, view_service2, geometries, type_code='CodeB' ) inside_plrs = [plr1] outside_plrs = [plr2, plr3] after_process = Processor.get_legend_entries(inside_plrs, outside_plrs) assert len(inside_plrs) == len(after_process) inside_plrs = [plr3] outside_plrs = [plr4] after_process = Processor.get_legend_entries(inside_plrs, outside_plrs) assert len(after_process) == 1