Closed pederhan closed 4 months ago
Comparing* with #255, we get the following diff between the two new_testsuite_log.json
files:
========================================================================
Command: network find -network <IPv4>/24 -description '*one host*' -vlan 1234 -frozen 1 -reserved 6 -dns_delegated 0 -category Yellow -location Somewhere -expected, +tested
========================================================================
[
{
"command": "network find -network <IPv4>/24 -description '*one host*' -vlan 1234 -frozen 1 -reserved 6 -dns_delegated 0 -category Yellow -location Somewhere",
"command_filter": null,
"command_filter_negate": false,
"command_issued": "network find -network <IPv4>/24 -description '*one host*' -vlan 1234 -frozen 1 -reserved 6 -dns_delegated 0 -category Yellow -location Somewhere",
"ok": [],
"warning": [
"No networks matching the query were found."
],
"error": [],
"output": [],
"api_requests": [
{
"method": "GET",
- "url": "/api/v1/networks/?network=<IPv4>/24&description__regex=.%2Aone%20host.%2A&vlan=1234&dns_delegated=0&category=Yellow&location=Somewhere&frozen=1&reserved=6",
? ^ ^^^
+ "url": "/api/v1/networks/?network=<IPv4>%2F24&description__regex=.%2Aone+host.%2A&vlan=1234&dns_delegated=0&category=Yellow&location=Somewhere&frozen=1&reserved=6",
? ^^^ ^
"data": {},
"status": 200,
"response": {
"count": 0,
"next": null,
"previous": null,
"results": []
}
}
],
"time": null
}
]
========================================================================
Command: host sshfp_add bar 1 1 12345678abcde -expected, +tested
========================================================================
[
{
"command": "host sshfp_add bar 1 1 12345678abcde",
"command_filter": null,
"command_filter_negate": false,
"command_issued": "host sshfp_add bar 1 1 12345678abcde",
"ok": [
"Added SSHFP record for bar.example.org."
],
"warning": [],
"error": [],
"output": [],
"api_requests": [
{
"method": "GET",
"url": "/api/v1/hosts/bar.example.org",
"data": {},
"status": 200,
"response": {
"ipaddresses": [
{
"macaddress": "",
"ipaddress": "<IPv4>",
"host": 14
},
{
"macaddress": "<IPv6>",
"ipaddress": "<IPv4>",
"host": 14
},
{
"macaddress": "",
"ipaddress": "<IPv6>",
"host": 14
}
],
"cnames": [],
"mxs": [],
"txts": [
{
"txt": "v=spf1 -all",
"host": 14
}
],
"ptr_overrides": [],
"hinfo": null,
"loc": null,
"bacnetid": null,
"name": "bar.example.org",
"contact": "me@example.org",
"ttl": null,
"comment": "This is the comment",
"zone": 1
}
},
{
"method": "GET",
"url": "/api/v1/sshfps/?algorithm=1&hash_type=1&fingerprint=12345678abcde&host=14",
"data": {},
"status": 200,
"response": {
"count": 0,
"next": null,
"previous": null,
"results": []
}
},
{
"method": "POST",
"url": "/api/v1/sshfps/",
"data": {
"algorithm": "1",
"hash_type": "1",
"fingerprint": "12345678abcde",
- "host": "14"
? - -
+ "host": 14
},
"status": 201,
"response": {
"ttl": null,
"algorithm": 1,
"hash_type": 1,
"fingerprint": "12345678abcde",
"host": 14
}
}
],
"time": null
}
]
I have tested network find
with spaces in descriptions, and I did not notice any differences in behavior between the two branches.
*I applied #271 as a patch when testing both branches to prevent extra noise from improperly escaped messages.
This PR replaces all bare dict annotations with a new
QueryParams
type. This type is more limited thanJsonMapping
, and does not allow dict, list and float values (maybe float should be allowed?).Everywhere where we construct inline query param dicts has been rewritten to use this new type annotation. Furthermore, all explicit conversion of query param values to strings has been removed, since passing ints and None as query param values is valid.
As part of this PR, the
Endpoint.with_query()
method has been removed, since we delegate the construction of the query param string to the requests library instead of doing it ourselves.Future work
APIMixin.get_by_field()
andget_item_by_key_value()
should be looked at to support integer values in addition to strings.