def test_get_symbol_ref(config, theme_code): assert isinstance(config._config, dict) with pyramid_oereb_test_config(): request = MockRequest() record = LegendEntryRecord(ImageRecord('1'.encode('utf-8')), {'de': 'Test'}, u'test', u'test', ThemeRecord(theme_code, {'de': 'Test'})) 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/{}/{}'.format( theme_code, record.type_code)
def test_get_symbol_ref(theme_code): with 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'}), 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 test_get_symbol_ref(config, theme_code): assert isinstance(config._config, dict) with pyramid_oereb_test_config(): request = MockRequest() record = LegendEntryRecord(ImageRecord('1'.encode('utf-8')), {'de': 'Test'}, u'test', u'test', ThemeRecord(theme_code, {'de': 'Test'})) 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/{}?TEXT={}&CODE={}'.format( theme_code, base64.b64encode( json.dumps(record.legend_text).encode('utf-8')).decode( 'ascii').replace('=', '%3D'), record.type_code)