feat: add comprehensive tests and samples for host and user rights endpoints
- Added GraphQL sample queries and mutations for host and user rights endpoints in the 'docs' directory. - Implemented unit tests for all remaining GraphQL endpoints, including hosts, devices, host groups, locations, and user permissions. - Created dedicated integration tests for host and user rights workflows, utilizing the new sample files. - Fixed a bug in 'HostImporter.getHostGroupHierarchyNames' to correctly process and sort nested host group hierarchies. - Refined Zabbix API mocking in tests to improve reliability and support path-based routing. - Verified all 38 tests across 11 suites pass successfully.
This commit is contained in:
parent
a3ed4886a3
commit
fdfd5f1e0e
14 changed files with 729 additions and 6 deletions
36
docs/sample_import_hosts_mutation.graphql
Normal file
36
docs/sample_import_hosts_mutation.graphql
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
### Mutation
|
||||
Use this mutation to import hosts and assign them to host groups.
|
||||
|
||||
```graphql
|
||||
mutation ImportHosts($hosts: [CreateHost!]!) {
|
||||
importHosts(hosts: $hosts) {
|
||||
deviceKey
|
||||
hostid
|
||||
message
|
||||
error {
|
||||
message
|
||||
code
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Variables
|
||||
```json
|
||||
{
|
||||
"hosts": [
|
||||
{
|
||||
"deviceKey": "TEST_DEVICE_001",
|
||||
"name": "Test Device 001",
|
||||
"deviceType": "bt_device_tracker_generic",
|
||||
"groupNames": ["ConstructionSite/Test"],
|
||||
"location": {
|
||||
"name": "Test Location",
|
||||
"location_lat": "52.5200",
|
||||
"location_lon": "13.4050"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue