mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-10 09:38:15 -06:00
16261 fixup test
This commit is contained in:
parent
d93569a5e1
commit
8f81418753
@ -649,7 +649,7 @@ class IPAddressTest(APIViewTestCases.APIViewTestCase):
|
|||||||
'description': 'New description',
|
'description': 'New description',
|
||||||
}
|
}
|
||||||
graphql_filter = {
|
graphql_filter = {
|
||||||
'address': '192.168.0.1/24',
|
'address': {'lookup': 'i_exact', 'value': '192.168.0.1/24'},
|
||||||
}
|
}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -496,7 +496,14 @@ class APIViewTestCases:
|
|||||||
Create a filtered query: i.e. ip_address_list(filters: {address: "1.1.1.1/24"}){.
|
Create a filtered query: i.e. ip_address_list(filters: {address: "1.1.1.1/24"}){.
|
||||||
"""
|
"""
|
||||||
if filters:
|
if filters:
|
||||||
filter_string = ', '.join(f'{k}: "{v}"' for k, v in filters.items())
|
for field_name, params in filters.items():
|
||||||
|
lookup = params['lookup']
|
||||||
|
value = params['value']
|
||||||
|
if lookup:
|
||||||
|
query = f'{{{lookup}: "{value}"}}'
|
||||||
|
filter_string = f'{field_name}: {query}'
|
||||||
|
else:
|
||||||
|
filter_string = f'{field_name}: "{value}"'
|
||||||
filter_string = f'(filters: {{{filter_string}}})'
|
filter_string = f'(filters: {{{filter_string}}})'
|
||||||
else:
|
else:
|
||||||
filter_string = ''
|
filter_string = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user