pax_global_header00006660000000000000000000000064144764202210014514gustar00rootroot0000000000000052 comment=061cefd82438cf382565b1a2df78fbdaf7d45827 geolinks-0.2.3/000077500000000000000000000000001447642022100133315ustar00rootroot00000000000000geolinks-0.2.3/.github/000077500000000000000000000000001447642022100146715ustar00rootroot00000000000000geolinks-0.2.3/.github/workflows/000077500000000000000000000000001447642022100167265ustar00rootroot00000000000000geolinks-0.2.3/.github/workflows/main.yml000066400000000000000000000020161447642022100203740ustar00rootroot00000000000000name: build ⚙️ on: [ push, pull_request ] jobs: main: runs-on: ubuntu-latest strategy: matrix: python-version: [3.7, 3.8] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 name: Setup Python ${{ matrix.python-version }} with: python-version: ${{ matrix.python-version }} - name: Install system dependencies 📦 run: sudo apt-get install -y dh-python devscripts fakeroot debhelper python3-all python3-setuptools - name: Install requirements 📦 run: | python3 -m pip install --upgrade pip pip3 install -r requirements.txt pip3 install -r requirements-dev.txt - name: Install package 📦 run: python3 setup.py install - name: run tests ⚙️ run: python3 setup.py test - name: run flake8 ⚙️ run: flake8 - name: build Python package 🏗️ run: python3 setup.py sdist bdist_wheel --universal - name: build Debian package 🏗️ run: sudo debuild -b -uc -us geolinks-0.2.3/.gitignore000066400000000000000000000010731447642022100153220ustar00rootroot00000000000000# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] # C extensions *.so # Distribution / packaging .Python env/ bin/ build/ develop-eggs/ dist/ eggs/ lib/ lib64/ parts/ sdist/ var/ *.egg-info/ .installed.cfg *.egg # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .coverage .cache nosetests.xml coverage.xml # Translations *.mo # Mr Developer .mr.developer.cfg .project .pydevproject # Rope .ropeproject # Django stuff: *.log *.pot # Sphinx documentation docs/_build/ # build artefacts MANIFEST geolinks-0.2.3/CODE_OF_CONDUCT.md000066400000000000000000000064311447642022100161340ustar00rootroot00000000000000# Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at tomkralidis@gmail.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq geolinks-0.2.3/CONTRIBUTING.md000066400000000000000000000110251447642022100155610ustar00rootroot00000000000000# Contributing to geolinks We welcome contributions to geolinks, in the form of issues, bug fixes, or suggestions for enhancements. This document sets out our guidelines and best practices for such contributions. It's based on the [Contributing to Open Source Projects Guide](https://contribution-guide-org.readthedocs.io/). geolinks has the following modes of contribution: - GitHub Commit Access - GitHub Pull Requests ## Code of Conduct Contributors to this project are expected to act respectfully toward others in accordance with the [OSGeo Code of Conduct](https://www.osgeo.org/code_of_conduct). ## Submitting Bugs ### Due Diligence Before submitting a bug, please do the following: * Perform __basic troubleshooting__ steps: * __Make sure you're on the latest version.__ If you're not on the most recent version, your problem may have been solved already! Upgrading is always the best first step. * [__Search the issue tracker__](https://github.com/geopython/geolinks/issues) to make sure it's not a known issue. ### What to put in your bug report Make sure your report gets the attention it deserves: bug reports with missing information may be ignored or punted back to you, delaying a fix. The below constitutes a bare minimum; more info is almost always better: * __What version of Python are you using?__ For example, are you using Python 2.7, Python 3.7, PyPy 2.0? * __What operating system are you using?__ Windows (7, 8, 10, 32-bit, 64-bit), Mac OS X, (10.7.4, 10.9.0), GNU/Linux (which distribution, which version?) Again, more detail is better. * __Which version or versions of the software are you using?__ Ideally, you've followed the advice above and are on the latest version, but please confirm this. * __How can the we recreate your problem?__ Imagine that we have never used geolinks before and have downloaded it for the first time. Exactly what steps do we need to take to reproduce your problem? ## Contributions and Licensing ### Contributor License Agreement Your contribution will be under our [license](https://github.com/geopython/geolinks/blob/master/LICENSE.md) as per [GitHub's terms of service](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license). ### GitHub Commit Access * Proposals to provide developers with GitHub commit access shall be emailed to the geolinks [mailing list](https://lists.osgeo.org/mailman/listinfo/geolinks). Proposals shall be approved by the geolinks development team. Committers shall be added by the project admin. * Removal of commit access shall be handled in the same manner. ### GitHub Pull Requests * Pull requests may include copyright in the source code header by the contributor if the contribution is significant or the contributor wants to claim copyright on their contribution. * All contributors shall be listed at https://github.com/geopython/geolinks/graphs/contributors * Unclaimed copyright, by default, is assigned to the main copyright holders as specified in https://github.com/geopython/geolinks/blob/master/LICENSE.md ### Version Control Branching * Always __make a new branch__ for your work, no matter how small. This makes it easy for others to take just that one set of changes from your repository, in case you have multiple unrelated changes floating around. * __Don't submit unrelated changes in the same branch/pull request!__ If it is not possible to review your changes quickly and easily, we may reject your request. * __Base your new branch off of the appropriate branch__ on the main repository: * In general the released version of geolinks is based on the ``master`` (default) branch whereas development work is done under other non-default branches. Unless you are sure that your issue affects a non-default branch, __base your branch off the ``master`` one__. * Note that depending on how long it takes for the dev team to merge your patch, the copy of ``master`` you worked off of may get out of date! * If you find yourself 'bumping' a pull request that's been sidelined for a while, __make sure you rebase or merge to latest ``master``__ to ensure a speedier resolution. ### Code Formatting * __Please follow the coding conventions and style used in the geolinks repository.__ * geolinks endeavours to follow the [PEP-8](http://www.python.org/dev/peps/pep-0008/) guidelines. ## Suggesting Enhancements We welcome suggestions for enhancements, but reserve the right to reject them if they do not follow future plans for geolinks. geolinks-0.2.3/LICENSE.md000066400000000000000000000021101447642022100147270ustar00rootroot00000000000000# The MIT License (MIT) Copyright © 2014-2022 Tom Kralidis * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. geolinks-0.2.3/MANIFEST.in000066400000000000000000000000761447642022100150720ustar00rootroot00000000000000include README.md include LICENSE.md include requirements.txt geolinks-0.2.3/README.md000066400000000000000000000043441447642022100146150ustar00rootroot00000000000000[![Build Status](https://github.com/geopython/geolinks/workflows/build%20%E2%9A%99%EF%B8%8F/badge.svg)](https://github.com/geopython/geolinks/actions) # geolinks Utilities to deal with geospatial links. Working implementation of the Cat-Interop work at https://github.com/OSGeo/Cat-Interop ## Installation geolinks is best installed and used within a Python virtualenv. ### Requirements * Python 3 and above * Python [virtualenv](https://virtualenv.pypa.io/) package ### Dependencies Dependencies are listed in [requirements.txt](requirements.txt). Dependencies are automatically installed during geolinks's installation. ### Installing the Package from source: ```bash python3 -m venv my-env cd my-env . bin/activate git clone https://github.com/geopython/geolinks.git cd geolinks python3 setup.py build python3 setup.py install ``` via pip: ```bash pip3 install geolinks ``` ## Running ```bash geolinks link sniff 'http://host/wms?service=WMS' ``` ## Using the API from Python ```python >>> from geolinks import sniff_link >>> sniff_link('http://host/wms?service=WMS') 'OGC:WMS' >>> sniff_link('http://host/wms?service=WPS') 'OGC:WPS' >>> sniff_link('http://host/wms?service=CSW') 'OGC:CSW' >>> sniff_link('http://host/data/roads.kmz') 'OGC:KML' >>> sniff_link('http://host/data/roads.kml') 'OGC:KML' ``` ### Running Tests ```bash # via setuptools python3 setup.py test # manually cd tests python3 run_tests.py ``` ## Development ### Setting up a Development Environment Same as installing a package. Use a virtualenv. Also install developer requirements: ```bash pip3 install -r requirements-dev.txt ``` ## Releasing ```bash vi geolinks/__init__.py git commit -m 'update release version' geolinks/__init__.py vi debian/changelog # add changelog entry and summary of updates # push changes git push origin master git tag -a x.y.z -m 'tagging release x.y.z' # push tag git push --tags rm -fr build dist *.egg-info python3 setup.py sdist bdist_wheel --universal twine upload dist/* ``` ### Code Conventions * [PEP8](https://www.python.org/dev/peps/pep-0008) ### Bugs and Issues All bugs, enhancements and issues are managed on [GitHub](https://github.com/geopython/geolinks/issues). ## Contact * [Tom Kralidis](https://github.com/tomkralidis) geolinks-0.2.3/SECURITY.md000066400000000000000000000010471447642022100151240ustar00rootroot00000000000000# geolinks Security Policy ## Reporting Security/vulnerability reports **should not** be submitted through GitHub issues or public discussions, but instead please send your report to **geopython-security nospam @ lists.osgeo.org** - (remove the blanks and 'nospam'). ## Supported Versions geolinks developers will release patches for security vulnerabilities for the following versions: | Version | Supported | | ------- | ------------------ | | latest stable version | :white_check_mark: | | previous versions | :x: | geolinks-0.2.3/debian/000077500000000000000000000000001447642022100145535ustar00rootroot00000000000000geolinks-0.2.3/debian/changelog000066400000000000000000000006411447642022100164260ustar00rootroot00000000000000geolinks (0.2.3) focal; urgency=medium * packaging fixes -- Tom Kralidis Thu, 7 Sep 2023 19:11:34 +0000 geolinks (0.2.2) focal; urgency=medium * packaging fixes -- Tom Kralidis Thu, 7 Sep 2023 00:52:43 +0000 geolinks (0.2.1) focal; urgency=medium * housekeeping release update -- Tom Kralidis Sun, 26 Feb 2023 16:30:16 +0000 geolinks-0.2.3/debian/compat000066400000000000000000000000031447642022100157520ustar00rootroot0000000000000012 geolinks-0.2.3/debian/control000066400000000000000000000013111447642022100161520ustar00rootroot00000000000000Source: geolinks Section: python Priority: optional Maintainer: Tom Kralidis Uploaders: Angelos Tzotsos Johan Van de Wauw Build-Depends: debhelper (>= 12), dh-python, python3-all, python3-setuptools Standards-Version: 4.6.1 Vcs-Git: https://github.com/geopython/geolinks.git Homepage: https://github.com/geopython/geolinks Package: python3-geolinks Architecture: all Depends: ${python3:Depends}, python3-click, ${misc:Depends} Description: Utilities to deal with geospatial links. Working implementation of the Cat-Interop work at https://github.com/OSGeo/Cat-Interop geolinks-0.2.3/debian/copyright000066400000000000000000000023131447642022100165050ustar00rootroot00000000000000Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Source: https://github.com/geopython/geolinks Files: * Copyright: Copyright 2022 Tom Kralidis License: MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: . The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. . THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. geolinks-0.2.3/debian/rules000077500000000000000000000003641447642022100156360ustar00rootroot00000000000000#!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 export PYBUILD_NAME=geolinks %: dh $@ --with python3 --buildsystem pybuild override_dh_auto_test: @echo "nocheck set, not running tests" geolinks-0.2.3/debian/source/000077500000000000000000000000001447642022100160535ustar00rootroot00000000000000geolinks-0.2.3/debian/source/format000066400000000000000000000000141447642022100172610ustar00rootroot000000000000003.0 (quilt) geolinks-0.2.3/geolinks/000077500000000000000000000000001447642022100151445ustar00rootroot00000000000000geolinks-0.2.3/geolinks/__init__.py000066400000000000000000000115121447642022100172550ustar00rootroot00000000000000# ================================================================= # # Authors: Tom Kralidis # # Copyright (c) 2023 Tom Kralidis # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # ================================================================= import logging import sys from typing import Union import click LOGGER = logging.getLogger(__name__) __version__ = '0.2.3' def CLICK_OPTION_VERBOSITY(f): logging_options = ['ERROR', 'WARNING', 'INFO', 'DEBUG'] def callback(ctx, param, value): if value is not None: logging.basicConfig(stream=sys.stdout, level=getattr(logging, value)) return True return click.option('--verbosity', '-v', type=click.Choice(logging_options), help='Verbosity', callback=callback)(f) def inurl(needles, haystack, position='any') -> bool: """ convenience function to find a given value in a URL :param needles: `list` of patterns to test :param haystack: value to search / detect for patterns returns: `bool` of assessment """ count = 0 # lowercase everything to do case-insensitive search haystack2 = haystack.lower() for needle in needles: needle2 = needle.lower() if position == 'any': if haystack2.find(needle2) > -1: count += 1 elif position == 'end': if haystack2.endswith(needle2): count += 1 elif position == 'begin': if haystack2.startswith(needle2): count += 1 # assessment if count > 0: return True return False def sniff_link(url) -> Union[str, None]: """ performs basic heuristics to detect what the URL is :param url: `str` of URL :returns: possible link type or `None` """ protocol = None link = url.strip() # heuristics begin if inurl(['service=CSW', 'request=GetRecords'], link): protocol = 'OGC:CSW' elif inurl(['service=SOS', 'request=GetObservation'], link): protocol = 'OGC:SOS' elif inurl(['service=WCS', 'request=GetCoverage'], link): protocol = 'OGC:WCS' elif inurl(['service=WFS', 'request=GetFeature'], link): protocol = 'OGC:WFS' elif inurl(['service=WMS', 'request=GetMap'], link): protocol = 'OGC:WMS' elif inurl(['service=WPS', 'request=Execute'], link): protocol = 'OGC:WPS' elif inurl(['arcims'], link): protocol = 'ESRI:ArcIMS' elif inurl(['arcgis'], link): protocol = 'ESRI:ArcGIS' elif inurl(['mpk'], link, 'end'): protocol = 'ESRI:MPK' elif inurl(['opendap'], link): protocol = 'OPeNDAP:OPeNDAP' elif inurl(['ncss'], link): protocol = 'UNIDATA:NCSS' elif inurl(['cdmremote'], link): protocol = 'UNIDATA:CDM' elif inurl(['gml'], link, 'end'): protocol = 'OGC:GML' elif inurl(['htm', 'html', 'shtml'], link, 'end'): protocol = 'WWW:LINK' # extra tests elif all([inurl(['census.gov/geo/tiger'], link), inurl(['zip'], link, 'end')]): protocol = 'ESRI:SHAPEFILE' elif inurl(['7z', 'bz2', 'gz', 'rar', 'tar.gz', 'tgz', 'zip'], link, 'end'): protocol = 'WWW:DOWNLOAD' elif inurl(['kml', 'kmz'], link, 'end'): protocol = 'OGC:KML' else: LOGGER.info('No link type detected') return protocol @click.group() @click.version_option(version=__version__) def cli(): pass @click.group() def link(): """Link utilities""" pass @click.command() @click.argument('link') @CLICK_OPTION_VERBOSITY def sniff(link, verbosity): """Sniff link""" click.echo(f'Sniffing link: {link}') link_type = sniff_link(link) click.echo(f'Link type: {link_type}') link.add_command(sniff) cli.add_command(link) geolinks-0.2.3/pyproject.toml000066400000000000000000000001211447642022100162370ustar00rootroot00000000000000[build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" geolinks-0.2.3/requirements-dev.txt000066400000000000000000000000231447642022100173640ustar00rootroot00000000000000flake8 twine wheel geolinks-0.2.3/requirements.txt000066400000000000000000000000061447642022100166110ustar00rootroot00000000000000click geolinks-0.2.3/setup.py000066400000000000000000000066261447642022100150550ustar00rootroot00000000000000# ================================================================= # # Authors: Tom Kralidis # # Copyright (c) 2022 Tom Kralidis # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # ================================================================= import io import os import re import sys from setuptools import Command, find_packages, setup class PyTest(Command): user_options = [] def initialize_options(self): pass def finalize_options(self): pass def run(self): import subprocess errno = subprocess.call([sys.executable, 'tests/run_tests.py']) raise SystemExit(errno) def read(filename, encoding='utf-8'): """read file contents""" full_path = os.path.join(os.path.dirname(__file__), filename) with io.open(full_path, encoding=encoding) as fh: return fh.read().strip() def get_package_version(): """get version from top-level package init""" version_file = read('geolinks/__init__.py') version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M) if version_match: return version_match.group(1) raise RuntimeError("Unable to find version string.") LONG_DESCRIPTION = read('README.md') setup( name='geolinks', version=get_package_version(), description='Utilities to deal with geospatial links', long_description=LONG_DESCRIPTION, long_description_content_type='text/markdown', license='MIT', platforms='all', keywords='links geo protocol url href', author='Tom Kralidis', author_email='tomkralidis@gmail.com', maintainer='Tom Kralidis', maintainer_email='tomkralidis@gmail.com', url='https://github.com/geopython/geolinks', install_requires=read('requirements.txt').splitlines(), packages=find_packages(), entry_points={ 'console_scripts': [ 'geolinks=geolinks:cli' ] }, classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Console', 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 3.5', 'Topic :: Scientific/Engineering :: GIS', ], cmdclass={'test': PyTest}, test_suite='tests.run_tests' ) geolinks-0.2.3/tests/000077500000000000000000000000001447642022100144735ustar00rootroot00000000000000geolinks-0.2.3/tests/run_tests.py000066400000000000000000000043301447642022100170730ustar00rootroot00000000000000# ================================================================= # # Authors: Tom Kralidis # # Copyright (c) 2022 Tom Kralidis # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # ================================================================= import json import os.path import unittest from geolinks import sniff_link class GeolinksTest(unittest.TestCase): """Test suite for package Foo""" def setUp(self): """setup test fixtures, etc.""" test_data = None if os.path.exists('test_data.json'): test_data = 'test_data.json' elif os.path.exists('tests/test_data.json'): test_data = 'tests/test_data.json' else: raise FileNotFoundError() with open(test_data) as f: self.test_data = json.load(f) def tearDown(self): """return to pristine state""" pass def test_link_types(self): """simple link type tests""" for test in self.test_data['test_data']: self.assertEqual(sniff_link(test['link']), test['expected'], f"Expected {test['link']} and {test['expected']} to be equal") # noqa if __name__ == '__main__': unittest.main() geolinks-0.2.3/tests/test_data.json000066400000000000000000000025411447642022100173400ustar00rootroot00000000000000{ "test_data": [ {"link": "http://host/wms?service=WMS", "expected": "OGC:WMS"}, {"link": "http://host/ows?service=WFS", "expected": "OGC:WFS"}, {"link": "http://host/ows?service=WCS", "expected": "OGC:WCS"}, {"link": "http://host/ows?service=WPS", "expected": "OGC:WPS"}, {"link": "http://host/csw?service=CSW", "expected": "OGC:CSW"}, {"link": "http://host/data/roads.kmz", "expected": "OGC:KML"}, {"link": "http://host/data/roads.kml", "expected": "OGC:KML"}, {"link": "http://host/data/data.html", "expected": "WWW:LINK"}, {"link": "http://host/download/admin.mpk", "expected": "ESRI:MPK"}, {"link": "http://host/data.7z", "expected": "WWW:DOWNLOAD"}, {"link": "http://host/data.tgz", "expected": "WWW:DOWNLOAD"}, {"link": "http://host/data/data.zip", "expected": "WWW:DOWNLOAD"}, {"link": "http://host/data/data.gz", "expected": "WWW:DOWNLOAD"}, {"link": "http://host/data/file.gml", "expected": "OGC:GML"}, {"link": "http://host/data/file.gml.gz", "expected": "WWW:DOWNLOAD"}, {"link": "http://host/data.tar.gz", "expected": "WWW:DOWNLOAD"}, {"link": "http://host/sos?service=SOS&request=GetObservation", "expected": "OGC:SOS"}, {"link": "http://host/sos?service=SOS&request=GetObservation", "expected": "OGC:SOS"} ] }