-
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…
- Loading branch information
1 parent
1409746
commit b9727ff
Showing
3 changed files
with
77 additions
and
13 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,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 = { | ||
"name": "test_cf", | ||
"slug": "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", | ||
"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["name"] == "test_cf" | ||
|
||
def test_custom_field_choice_value(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["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