Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 2 additions & 20 deletions .github/workflows/test_and_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
strategy:
matrix:
include:
# - python-version: 2.7
# os: ubuntu-20.04
# - python-version: 3.6
# os: ubuntu-20.04
- python-version: 3.7
Expand All @@ -38,17 +36,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }} != 2.7
if: ${{ matrix.python-version != '2.7' }}
- name: Set up Python ${{ matrix.python-version }}
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: |
Expand Down Expand Up @@ -93,8 +84,6 @@ jobs:
strategy:
matrix:
include:
# - python-version: 2.7
# os: ubuntu-20.04
# - python-version: 3.6
# os: ubuntu-20.04
- python-version: 3.7
Expand All @@ -112,17 +101,10 @@ jobs:

if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Set up Python ${{ matrix.python-version }} != 2.7
if: ${{ matrix.python-version != '2.7' }}
- name: Set up Python ${{ matrix.python-version }}
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: Upgrade pip
run: python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion domainconnectzone/sigutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_publickey(domain):
pembits = ''

try:
records = dns.resolver.query(domain, 'TXT') # Get all text records
records = dns.resolver.resolve(domain, 'TXT') # Get all text records
record_strings = []
for record in records:
text = record.strings[0].decode('utf-8')
Expand Down
18 changes: 6 additions & 12 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
cryptography>=3.3.2; python_version == '2.7'
cryptography>=39.0.1; python_version > '2.7' and python_version < '3.6'
cryptography>=39.0.1; python_version >= '3.0' and python_version < '3.6'
cryptography>=40.0.2; python_version >= '3.6' and python_version < '3.7'
cryptography>=42.0.3; python_version >= '3.7'
dnspython>=1.16.0; python_version == '2.7'
dnspython3>=1.15.0; python_version > '2.7'
dnspython>=2.0.0; python_version >= '3.0'
ipy>=1.1
jsonschema>=3.2.0; python_version == '2.7'
jsonschema>=4.0.0; python_version > '2.7'
jsonschema>=4.0.0; python_version >= '3.0'
requests>=2.27.1; python_version < '3.7'
requests>=2.31.0; python_version >= '3.7'
six>=1.16.0
validators>=0.14.2; python_version == '2.7'
validators>=0.20.0; python_version > '2.7'
validators>=0.20.0; python_version >= '3.0'
coverage>=5.5
pytest>=4.6; python_version == '2.7'
pytest>=7.0; python_version > '2.7'
pytest>=7.0; python_version >= '3.0'
mock>=3.0.5; python_version < '3.3'
PyYAML>=5.1,<6.0; python_version == '2.7'
PyYAML>=6.0; python_version > '2.7'
PyYAML>=6.0; python_version >= '3.0'
12 changes: 4 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
cryptography>=3.3.2; python_version == '2.7'
cryptography>=39.0.1; python_version > '2.7' and python_version < '3.6'
cryptography>=39.0.1; python_version >= '3.0' and python_version < '3.6'
cryptography>=40.0.2; python_version >= '3.6' and python_version < '3.7'
cryptography>=42.0.3; python_version >= '3.7'
dnspython>=1.16.0; python_version == '2.7'
dnspython3>=1.15.0; python_version > '2.7'
dnspython>=2.0.0; python_version >= '3.0'
ipy>=1.1
jsonschema>=3.2.0; python_version == '2.7'
jsonschema>=4.0.0; python_version > '2.7'
jsonschema>=4.0.0; python_version >= '3.0'
requests>=2.27.1; python_version < '3.7'
requests>=2.31.0; python_version >= '3.7'
six>=1.16.0
validators>=0.14.2; python_version == '2.7'
validators>=0.20.0; python_version > '2.7'
validators>=0.20.0; python_version >= '3.0'
13 changes: 2 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,14 @@ def run(self):
extras_require={
'testing': [
'coverage>=5.5',
'pytest>=4.6; python_version == "2.7"',
'pytest>=7.0; python_version > "2.7"',
'pytest>=7.0; python_version >= "3.0"',
'mock>=3.0.5; python_version < "3.3"',
],
'docs': [
'phinx>=7.4.7',
'sphinx-rtd-theme>=2.0.0'
],
':python_version == "2.7"': [
'cryptography>=3.3.2',
'dnspython>=1.16.0',
'jsonschema>=3.2.0',
'requests>=2.27.1',
'validators>=0.14.2',
],
':python_version > "2.7" and python_version < "3.6"': [
':python_version >= "3.0" and python_version < "3.6"': [
'cryptography>=39.0.1',
'dnspython3>=1.15.0',
'jsonschema>=4.0.0',
Expand All @@ -102,7 +94,6 @@ def run(self):
],
},
classifiers=[
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
Expand Down
10 changes: 5 additions & 5 deletions test/test_sigutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_exception_handling(self):

class TestGetPublicKey(unittest.TestCase):

@patch('dns.resolver.query')
@patch('dns.resolver.resolve')
def test_get_publickey(self, mock_query):
# Mock DNS TXT records
mock_records = MagicMock()
Expand All @@ -104,7 +104,7 @@ def test_get_publickey(self, mock_query):
expected_key = '-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqG9w0BAQEFAAOCAQ8AMIIBCgKCAQE\n-----END PUBLIC KEY-----\n'
self.assertEqual(get_publickey(domain), expected_key)

@patch('dns.resolver.query')
@patch('dns.resolver.resolve')
def test_get_publickey_full_spec(self, mock_query):
# Mock DNS TXT records with fully specified algorithm and type
mock_records = MagicMock()
Expand All @@ -122,7 +122,7 @@ def test_get_publickey_full_spec(self, mock_query):
expected_key = '-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqG9w0BAQEFAAOCAQ8AMIIBCgKCAQE\n-----END PUBLIC KEY-----\n'
self.assertEqual(get_publickey(domain), expected_key)

@patch('dns.resolver.query')
@patch('dns.resolver.resolve')
def test_get_publickey_with_invalid_data(self, mock_query):
# Mock DNS TXT record with invalid data
mock_records = MagicMock()
Expand All @@ -135,7 +135,7 @@ def test_get_publickey_with_invalid_data(self, mock_query):
domain = 'example.com'
self.assertIsNone(get_publickey(domain))

@patch('dns.resolver.query')
@patch('dns.resolver.resolve')
def test_get_publickey_with_invalid_algorithm(self, mock_query):
# Mock DNS TXT record with unsupported algorithm
mock_records = MagicMock()
Expand All @@ -148,7 +148,7 @@ def test_get_publickey_with_invalid_algorithm(self, mock_query):
domain = 'example.com'
self.assertIsNone(get_publickey(domain))

@patch('dns.resolver.query')
@patch('dns.resolver.resolve')
def test_get_publickey_with_invalid_type(self, mock_query):
# Mock DNS TXT record with unsupported type
mock_records = MagicMock()
Expand Down
Loading