Skip to content

Commit

Permalink
Add some manual curl tests for the api
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteOtter committed May 27, 2024
1 parent d94de35 commit 0d6e9be
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ Cargo.lock
# output.txt file used for testing
output.txt
output.json

# Test output
test/manual/**/output/
6 changes: 6 additions & 0 deletions test/manual/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Manual Tests

This directory contains scripts and files used to manually test Nazara or a given NetBox API.

These can be used for sanity checking API responses to troubleshoot
potential parsing errors.
23 changes: 23 additions & 0 deletions test/manual/api/get_nazara_interface.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Test NetBox's API response by manually requesting information.
# Must be run *after* running Nazara and registering your device.

# USAGE:
# ./test_interfaces.sh $URL $TOKEN

if [ "$#" -ne 2 ]; then
echo "Usage: $0 <NetBox_URL> <Authorization_Token>"
exit 1
fi

url=$1
token=$2


curl -X POST "$url/api/dcim/interfaces/" \
-H "Authorization: Token $token" \
-H "Content-Type: application/json" \
-d '{"name": "Nazara0", "device": 112, "type": "1000base-t"}' \
-o "./output/interfaces.json"

0 comments on commit 0d6e9be

Please sign in to comment.