def test_get_symbol_missing_param(config, params): assert isinstance(config._config, dict) request = DummyRequest() request.matchdict.update({'theme_code': 'ContaminatedSites'}) request.params.update(params) with pytest.raises(HTTPBadRequest): get_symbol(request)
def test_get_symbol_not_found(config): assert isinstance(config._config, dict) request = DummyRequest() request.matchdict.update({ 'theme_code': 'ContaminatedSites', 'type_code': 'missing' }) with pytest.raises(HTTPNotFound): get_symbol(request)
def test_get_symbol_invalid_theme_code(config): assert isinstance(config._config, dict) request = DummyRequest() request.matchdict.update({ 'theme_code': 'InvalidThemeCode', 'type_code': 'test' }) with pytest.raises(HTTPNotFound): get_symbol(request)
def test_get_symbol_not_found(): request = DummyRequest() request.matchdict.update({ 'theme_code': 'ContaminatedSites', 'view_service_id': '1', 'type_code': 'missing' }) with pytest.raises(HTTPNotFound): get_symbol(request)
def test_get_symbol_invalid_theme_code(): request = DummyRequest() request.matchdict.update({ 'theme_code': 'InvalidThemeCode', 'view_service_id': '1', 'type_code': 'CodeA' }) with pytest.raises(HTTPNotFound): get_symbol(request)
def test_get_symbol_not_found(config): assert isinstance(config._config, dict) request = DummyRequest() request.matchdict.update({'theme_code': 'ContaminatedSites'}) request.params.update({ 'CODE': 'foo', 'TEXT': base64.b64encode(json.dumps({ 'en': 'bar' }).encode('utf-8')).decode('ascii') }) with pytest.raises(HTTPNotFound): get_symbol(request)
def test_get_symbol(config): assert isinstance(config._config, dict) request = DummyRequest() request.matchdict.update({ 'theme_code': 'ContaminatedSites', 'type_code': 'test' }) response = get_symbol(request) assert response.body.decode('utf-8') == '1'
def test_get_symbol(): request = DummyRequest() request.matchdict.update({ 'theme_code': 'ContaminatedSites', 'view_service_id': '1', 'type_code': 'CodeA' }) response = get_symbol(request) assert response.body.decode('utf-8') == '1'
def test_get_symbol(): request = DummyRequest() request.matchdict.update({ 'theme_code': 'ContaminatedSites', 'view_service_id': '1', 'type_code': 'CodeA' }) response = get_symbol(request) assert response.body == FileAdapter().read('tests/resources/symbol.png')
def test_get_symbol(config): assert isinstance(config._config, dict) request = DummyRequest() request.matchdict.update({'theme_code': 'ContaminatedSites'}) request.params.update({ 'CODE': 'test', 'TEXT': base64.b64encode(json.dumps({ 'de': 'Test' }).encode('utf-8')).decode('ascii') }) response = get_symbol(request) assert response.body.decode('utf-8') == '1'