-
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 custom_fields and custom_field_choices method overlap with endpoi…
…nts (#141)
- Loading branch information
1 parent
fbd94fd
commit 4c4995c
Showing
3 changed files
with
45 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
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" |
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