Skip to content

Commit

Permalink
Merge pull request #15: Create github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
pawel-kow authored Feb 18, 2024
2 parents d5a3a29 + b27fdbf commit 33eec16
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 44 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
user: domain-connect
password: ${{ secrets.PYPI_PASSWORD }}
distributions: "sdist bdist_wheel"
skip_existing: true
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

26 changes: 17 additions & 9 deletions domainconnect/tests/test_domainConnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
__email__ = "[email protected]"
__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
Expand All @@ -16,26 +24,26 @@

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,
API_URL='https://domainconnect.api.godaddy.com'
)

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',
Expand Down Expand Up @@ -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):
Expand Down
27 changes: 14 additions & 13 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 33eec16

Please sign in to comment.