Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status not showing up in choices for DCIM/Cables #452

Closed
FragmentedPacket opened this issue May 14, 2021 · 4 comments · Fixed by #457
Closed

Status not showing up in choices for DCIM/Cables #452

FragmentedPacket opened this issue May 14, 2021 · 4 comments · Fixed by #457
Labels
type: bug Something isn't working as expected

Comments

@FragmentedPacket
Copy link
Contributor

Environment

  • Python version: 3.7
  • Nautobot version: 1.0.1

Steps to Reproduce (Using pynautobot)

>>> from pynautobot import api
>>> nb = api("http://localhost:8000", "0123456789abcdef0123456789abcdef01234567")
>>> nb.dcim.cables.choices().keys()
dict_keys(['termination_a_type', 'termination_b_type', 'type', 'length_unit'])

These are fetched when using the OPTIONS HTTP verb against the list view.

I swear I've submitted an issue or two on this previously, but cannot seem to find them.

Expected Behavior

To list the three choices that come default for dcim | cables

image

Observed Behavior

See above. Status is not available as choices and fails playbooks in nautobot-ansible due to not finding the status when attempting to create a cable.

@glennmatthews
Copy link
Contributor

Possibly related to #382?

@FragmentedPacket
Copy link
Contributor Author

Not quite. These don't show up at all rather than having the incorrect key (display vs. display_name).

I'm wondering if the issue was tracked prior to public release. The endpoint provides no choices for status. I'll dig in deeper once I figure out which content types provide the status (programmatically) to make sure there aren't others.

@FragmentedPacket
Copy link
Contributor Author

Ok I found the commit - https://github.com/networktocode-llc/grimlock/pull/59/files?file-filters%5B%5D=.html&file-filters%5B%5D=.py

I'm attempting to figure out a way to have a dynamic test for any model that has status as an attribute for it test that choices are properly rendered, but not entirely sure how to accomplish the test or if a test should exist in multiple spots? Part of the provided API tests class and maybe the viewset as it looks like that is really where it's implemented as well.

@glennmatthews
Copy link
Contributor

Rather than any dynamic magic for 'status' field, probably simpler (better?) to add another test case mixin class that can be explicitly included in any API tests that should cover it.

@jedelman8 jedelman8 added status: under review type: bug Something isn't working as expected labels May 19, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants