-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: Update methods for custom fields (#114) Add method `custom_field_choices()` in `App` class. Rename method `custom_choices()` to `custom_fields()`. Update docstings for both methods according to returning data. * fix: Tests for methods for custom fields (#114) Add test case `AppCustomFieldChoicesTestCase` for `custom_field_choices()` method. Rename test case for `custom_fields()` method. Add using fixtures for mentioned test cases. * fix: Fixtures for tests (custom fields) (#114) Add missing JSON files with fixtures for tests for getting custom fields. * fix: Failing test for getting custom fields (#114) Fix test cases `AppCustomFieldsTestCase` and `AppCustomFieldChoicesTestCase` for python 3.7 stable. Update logic for checking passed arguments of mock's `call_args`. * Update api.py * max_workers added * max_workers added * Update query.py * Update query.py * max_workers from api to request * debug removed * Update api.py * Update query.py * refactor: Update docstrings and naming (#114) * (docs) update docstrings for `custom_fields()` and `custom_field_choices()` methods * (refactor): use f-strings instead of `.format()` in `custom_fields()` and `custom_field_choices()` * (tests): update naming in tests * (tests): use `return_value` instead of `side_effect` for mocks * fix: backward compatibility * (fix): restore original method `custom_choices()` for application class to provide a compatibility with existing client code * (enhance): add logging a deprecation warning * refactor: update `custom_choices()` (#114) * (refactor): call `custom_fields()` in `custom_choices()` since they represent essentially identical requests to Nautobot * Add version constraint to divide into two release trains 1.x and 2.x (#130) Add version constraint to divide into two release trains 1.x and 2.x * Release 2.0 (#136) * Release 2.0.0 --------- Co-authored-by: Jan Snasel <[email protected]> Co-authored-by: Joe Wesch <[email protected]> * Fix SSL verify (#140) (#142) * Fix custom_fields and custom_field_choices method overlap with endpoints (#141) (#144) * Release 2.0.1 --------- Co-authored-by: nautics889 <[email protected]> Co-authored-by: NobodyIsPerfect78 <[email protected]> Co-authored-by: Josh VanDeraa <[email protected]> Co-authored-by: Joe Wesch <[email protected]> Co-authored-by: Jan Snasel <[email protected]>
- Loading branch information
1 parent
365c287
commit f4e0384
Showing
9 changed files
with
208 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
[tool.poetry] | ||
name = "pynautobot" | ||
version = "2.0.0" | ||
version = "2.0.1" | ||
description = "Nautobot API client library" | ||
authors = ["Network to Code, LLC <[email protected]>"] | ||
readme = "README.md" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import pytest | ||
|
||
|
||
class TestCustomField: | ||
|
||
"""Verify we can create, custom field, and custom field choices.""" | ||
|
||
@pytest.fixture(scope="session") | ||
def create_custom_field(self, nb_client): | ||
data = { | ||
"label": "test_cf", | ||
"key": "test_cf", | ||
"content_types": ["dcim.device"], | ||
"type": "select", | ||
"weight": 100, | ||
"filter_logic": "loose", | ||
} | ||
return nb_client.extras.custom_fields.create(**data) | ||
|
||
@pytest.fixture(scope="session") | ||
def create_custom_field_choices(self, nb_client, create_custom_field): | ||
data = { | ||
"value": "A", | ||
"custom_field": create_custom_field["id"], | ||
"weight": 100, | ||
} | ||
return nb_client.extras.custom_field_choices.create(**data) | ||
|
||
def test_custom_field(self, create_custom_field): | ||
assert create_custom_field["label"] == "test_cf" | ||
|
||
def test_custom_field_choice(self, create_custom_field_choices): | ||
assert create_custom_field_choices["value"] == "A" | ||
|
||
def test_custom_field_choice_to_cf(self, create_custom_field_choices, create_custom_field): | ||
assert create_custom_field_choices["custom_field"]["id"] == create_custom_field["id"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters