Skip to content

Commit

Permalink
Merge pull request infobloxopen#367 from infobloxopen/bugfix/gh_workf…
Browse files Browse the repository at this point in the history
…lows

Fixed python version incompatibility in GH workflow
  • Loading branch information
Aleksei Chernevskii authored May 9, 2023
2 parents a6fba80 + 28aec77 commit 4c518ae
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
8 changes: 3 additions & 5 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Issue/Feature description

*
*

# How it was fixed/implemented

*
*

# Tests

*

# Reviewers
*
14 changes: 5 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
# you can turn it on using a cron schedule for regular testing.
name: Unit Tests
on:
pull_request:
paths-ignore:
- 'README.md'
- 'docs/**'
push:
paths-ignore:
- 'README.md'
Expand All @@ -17,10 +13,10 @@ jobs:
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.6
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: '3.6'
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -31,7 +27,7 @@ jobs:
TOXENV: pep8
test:
name: Unit Test
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
timeout-minutes: 15
strategy:
fail-fast: false
Expand Down Expand Up @@ -72,10 +68,10 @@ jobs:
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.6
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: '3.6'
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
18 changes: 11 additions & 7 deletions tests/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ def test_get_object_with_default_and_extattrs(self):
return_fields=return_fields
)
patched_get.assert_called_once_with(
'https://infoblox.example.org/wapi/v1.1/network?%2ASubnet+ID=fake_subnet_id&_return_fields%2B=extattrs', # noqa: E501
'https://infoblox.example.org/wapi/v1.1/network?%2ASubnet+ID=fake_subnet_id&_return_fields%2B=extattrs',
# noqa: E501
headers=self.connector.DEFAULT_HEADER,
timeout=self.default_opts.http_request_timeout,
verify=self.default_opts.ssl_verify,
Expand All @@ -197,7 +198,8 @@ def test_get_object_with_specific_return_fields(self):
return_fields=return_fields
)
patched_get.assert_called_once_with(
'https://infoblox.example.org/wapi/v1.1/network?%2ASubnet+ID=fake_subnet_id&_return_fields=extattrs', # noqa: E501
'https://infoblox.example.org/wapi/v1.1/network?%2ASubnet+ID=fake_subnet_id&_return_fields=extattrs',
# noqa: E501
headers=self.connector.DEFAULT_HEADER,
timeout=self.default_opts.http_request_timeout,
verify=self.default_opts.ssl_verify,
Expand Down Expand Up @@ -340,22 +342,25 @@ def test_construct_url_with_query_params_and_extattrs(self):
query_params=query_params,
extattrs=ext_attrs)
self.assertEqual(
'https://infoblox.example.org/wapi/v1.1/network?%2ASubnet+ID=fake_subnet_id&some_option=some_value', # noqa: E501
'https://infoblox.example.org/wapi/v1.1/network?%2ASubnet+ID=fake_subnet_id&some_option=some_value',
# noqa: E501
url)

def test_construct_url_with_query_params_containing_array(self):
query_params = {'array_option': ['value1', 'value2']}
url = self.connector._construct_url('network',
query_params=query_params)
self.assertEqual('https://infoblox.example.org/wapi/v1.1/network?array_option=value1&array_option=value2', # noqa: E501
self.assertEqual('https://infoblox.example.org/wapi/v1.1/network?array_option=value1&array_option=value2',
# noqa: E501
url)

def test_construct_url_with_force_proxy(self):
ext_attrs = {'Subnet ID': {'value': 'fake_subnet_id'}}
url = self.connector._construct_url('network',
extattrs=ext_attrs,
force_proxy=True)
self.assertEqual('https://infoblox.example.org/wapi/v1.1/network?%2ASubnet+ID=fake_subnet_id&_proxy_search=GM', # noqa: E501
self.assertEqual('https://infoblox.example.org/wapi/v1.1/network?%2ASubnet+ID=fake_subnet_id&_proxy_search=GM',
# noqa: E501
url)

def test_get_object_with_proxy_flag(self):
Expand All @@ -370,8 +375,7 @@ def test_get_object_with_proxy_flag(self):
{},
None,
force_proxy=True)
self.connector._get_object.called_with('network',
self.connector._construct_url)
self.connector._get_object.assert_called_with('network', mock.ANY)

def test_get_object_without_proxy_flag(self):
self.connector._get_object = mock.MagicMock(
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ deps =
-rtesting_requirements.txt
setenv =
passenv = *
whitelist_externals=mkdir
allowlist_externals = mkdir
commands =
mkdir -p {[setup]results}
nosetests tests \
Expand Down

0 comments on commit 4c518ae

Please sign in to comment.