diff --git a/.github/workflows/test-and-publish.yml b/.github/workflows/test-and-publish.yml new file mode 100644 index 0000000..bd527f9 --- /dev/null +++ b/.github/workflows/test-and-publish.yml @@ -0,0 +1,65 @@ +name: Python package + +on: + push: + branches: [ master ] + tags: + - '*' + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - python-version: 2.7 + os: ubuntu-20.04 + - python-version: 3.6 + os: ubuntu-20.04 + - python-version: 3.7 + os: ubuntu-22.04 + - python-version: 3.8 + os: ubuntu-22.04 + - python-version: 3.9 + os: ubuntu-22.04 + - python-version: "3.10" + os: ubuntu-22.04 + - python-version: "3.11" + os: ubuntu-22.04 + - python-version: "3.12" + os: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} != 2.7 + if: ${{ matrix.python-version != '2.7' }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Set up Python 2.7 + if: ${{ matrix.python-version == '2.7' }} + run: | + sudo ln -sf /usr/bin/python2.7 /usr/bin/python + curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py + sudo python get-pip.py + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-test.txt + + - name: Test with pytest + run: | + pytest + + - name: Build and publish to PyPI + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + uses: pypa/gh-action-pypi-publish@v1.4.2 + with: + user: domain-connect + password: ${{ secrets.PYPI_PASSWORD }} + distributions: "sdist bdist_wheel" + skip_existing: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 10cc291..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -dist: xenial -language: python -python: -- "2.7" -- "3.6" -- "3.7" -- "3.8" -- "3.9" -install: - - pip install -r requirements-test.txt -script: -- pytest -deploy: - provider: pypi - distributions: sdist bdist_wheel - user: domain-connect - password: - secure: 2ddCq65Cny17sogIFblscpidIhFYtS43ibRY4UkQu+H3ZRY8FCR7fX8Eeq8oCq2bI2Qsg5QEm9u09mZjH217YOi/uUPuDKU/bIur6lxRAHYsh5nnoqCQXVkDZ/5aQKysucxQFzQHvv47ARZZEwKeOCM9OsKbFYHgjTtfl23JE6hsLFdxRx6nT6uC1fxFJ+dxjWZoUIKIe2ymTy0sqed/gqs40sGa3nHc6qvQALQTKz+4lBEQJ74x47l58dLbDl4yi9aEv5pGxVpfmjrRVbSUSjj/j8h59ocXRzc0ATqItLdtQbt59SU7JYAcWnwCNj8b4jUP+oZVAqSnBENR+CyOHg+0s/PcuIWUdFAj1fNgqJs3tvwBZSnc4N60nQNSKfsJJ4pKK+jT1Z2A/gyGN0Fu7tTpYm0bgwAIO7JFheFVO4ykrjbP3+zQrP9TR/hlECIodZvzfw7zspmNPSkw0lNVzY0YHbtilHqqLk1A+uKTc3XDT8yrTQEsp/gfMwwZ/HJY+zFzy94ygyZT22ggB9o3kEsKvkerWK1Jhvyjk9CPl2Rs0jXKAzlWAjTnyZypwx5XrURYYqnxekWv5BSNg2Q6Bgt9lZmsfDxGjmUVD8t/CreXimAP2KzOxN/hJ1tDsvGTns3YGzh331yMQtFACboHxEU8Bc3sl8CScKmU2rJPCz4= - on: - tags: true - skip_existing: true - diff --git a/domainconnect/tests/test_domainConnect.py b/domainconnect/tests/test_domainConnect.py index 37212a9..44849f9 100644 --- a/domainconnect/tests/test_domainConnect.py +++ b/domainconnect/tests/test_domainConnect.py @@ -7,7 +7,15 @@ __email__ = "pawel-kow@users.noreply.github.com" __status__ = "Beta" -from unittest2 import TestCase, skipIf +import sys + +if sys.version_info[0] == 2 and sys.version_info[1] == 7: + # Python 2.7 + from unittest2 import TestCase, skipIf +else: + # Python 3.x + from unittest import TestCase, skipIf + from domainconnect import DomainConnect, DomainConnectAsyncCredentials, TemplateNotSupportedException, \ ConflictOnApplyException, NoDomainConnectRecordException, AsyncTokenException # to assure input works like raw_input in python 2 @@ -16,18 +24,18 @@ oneandone_config = \ dict( - PROVIDER_ID='1and1', - TEST_DOMAIN='connect.domains', - SYNC_URL='https://domainconnect.1and1.com/sync', - ASYNC_URL='https://domainconnect.1and1.com/async', + PROVIDER_ID='IONOS', + TEST_DOMAIN='diabtrack.com', + SYNC_URL='https://domainconnect.ionos.de/sync', + ASYNC_URL='https://domainconnect.ionos.de/async', ASYNC_SERVICE_IN_PATH=False, - API_URL='https://api.domainconnect.1and1.com' + API_URL='https://api.domainconnect.ionos.com' ) godaddy_config = \ dict( PROVIDER_ID='GoDaddy', - TEST_DOMAIN='ourtransfertestingwithgd2.com', + TEST_DOMAIN='domainconnectdnsdemo.net', SYNC_URL='https://dcc.godaddy.com/manage', ASYNC_URL='https://dcc.godaddy.com/manage', ASYNC_SERVICE_IN_PATH=True, @@ -35,7 +43,7 @@ ) test_credentials = { - "1and1": DomainConnectAsyncCredentials(client_id='exampleservice.domainconnect.org', + "IONOS": DomainConnectAsyncCredentials(client_id='exampleservice.domainconnect.org', client_secret='cd$;CVZRj#B8C@o3o8E4v-*k2H7S%)', api_url=oneandone_config['API_URL']), "GoDaddy": DomainConnectAsyncCredentials(client_id='exampleservice.domainconnect.org', @@ -155,7 +163,7 @@ def test_get_domain_connect_template_sync_url_with_signature(self): + '/v2/domainTemplates/providers/exampleservice.domainconnect.org/services/template2/apply' '?IP=132.148.25.185&RANDOMTEXT=shm%3A1531371203%3AHejo&domain=' + config['TEST_DOMAIN'] - + '&sig=E8lWecXOM7s4SwLp6bNhivmvqV47wynek6rO13iUIbC095p9WR5VnCY%2Fg8aUhazmM3squI0lr1wz5REiUIHVX5AP3reFbU6bLIzckgWoN9%2F3VgxtS9q%2FEgO8HL9%2FbTGjUodf9eI7afWXR348C8ekQFZeT%2F7SHMn7VvM%2BEpLA7ZDIq4kROJXE2eIOI21j6nkE4luWn2vWYdK%2BvUnp4YTzot03uj6cQ5nkpEziCJK5hqMqhZP5%2F755RLI3bH%2BpMvegFE2ualUM6BsvNJ4kyYNf250NyafLZU1RbkeUD1SM4KaUU59IY1PEKI44I21%2BfCPN8kAMFmTJqpNHLNffixNlgA%3D%3D&key=_dck1'), \ + + '&sig=IBLe5MctX7VUYYyPqhNAKWZaY8iobj9zIXIioPKVvpH8BulUxwP%2Fmdw1yWDyiv9ZYQRLkFnZNAZZ29ePcUKYWDqPo0YoHXl%2F%2FQwwCl0OqFFZyhatIbZb074QtX7np7Aji8VIN2jHElOY%2B8kVjWXk0YZpXWHuR80MlBKkUtaHKSs6gu3RAdhaT33kMANf3gHKhPka7401cZZcWAF5X1wbMKPNgjdyzVJmcv6NPBxpwGfEKbyf%2FUQ1UXkiVOWw709eILTIcFICG%2FbCYZGOQp%2BK53tGGZvSmlkGhHLxwQdP9R%2B56cjmgrIWdxOvrB%2FYKaFdhUABuv1dnPicuv31tTcKYQ%3D%3D&key=_dck1'), \ "URL is different than expected: {}".format(res) def test_generate_sig_params(self): diff --git a/requirements-test.txt b/requirements-test.txt index f013050..bfd04d1 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,13 +1,14 @@ -cffi==1.14.5 -cryptography==3.3.2 -dnspython==1.16.0 -enum34==1.1.10 -future==0.18.2 -ipaddress==1.0.23 -linecache2==1.0.0 -publicsuffix==1.1.1 -publicsuffixlist==0.7.7 -pycparser==2.20 -six==1.15.0 -traceback2==1.4.0 -unittest2==1.1.0 +cffi>=1.14.5 +cryptography>=3.3.2 +dnspython>=1.16.0 +enum34>=1.1.10 +future>=0.18.2 +ipaddress>=1.0.23 +linecache2>=1.0.0 +publicsuffix>=1.1.1 +publicsuffixlist>=0.7.7 +pycparser>=2.20 +six>=1.15.0 +traceback2>=1.4.0 +unittest2>=1.1.0 +pytest diff --git a/setup.py b/setup.py index 1c93436..f9f4502 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,9 @@ 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ], packages=[ 'domainconnect',