add various test shell scripts

This commit is contained in:
Uwe Steinmann 2023-01-20 15:21:01 +01:00
parent ed9c01e05a
commit 5b37300aa8
15 changed files with 100 additions and 0 deletions

5
tests/README.md Normal file
View File

@ -0,0 +1,5 @@
Create a file credentials and define AUTH and URL in it.
URL is the base url of the restapi service. AUTH are the credentials
as pass in http header Authorization. It can be ab basic authentication,
a papeerless or a regular SeedDMS token.

6
tests/test-api.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
. ./credentials
curl --silent "${URL}/api/" -H "Authorization: ${AUTH}" | jq '.'

7
tests/test-autocomplete.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
. ./credentials
curl --silent "${URL}/api/search/autocomplete/?term=wa" -H "Authorization: ${AUTH}"
#| jq '.'

View File

@ -0,0 +1,7 @@
#!/bin/sh
. ./credentials
curl -v -X DELETE "${URL}/api/saved_views/3/" -H "Authorization: ${AUTH}"
#| jq '.'

7
tests/test-delete.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
. ./credentials
curl -v -X DELETE "${URL}/api/documents/23761/" -H "Authorization: ${AUTH}"
#| jq '.'

View File

@ -0,0 +1,5 @@
#!/bin/sh
. ./credentials
curl -L --silent "${URL}/fetch/doc/23311" -H "Authorization: ${AUTH}" --output 23311.pdf

View File

@ -0,0 +1,6 @@
#!/bin/sh
. ./credentials
curl --silent "${URL}/api/documents/23768/metadata/" -H "Authorization: ${AUTH}" | jq '.'

7
tests/test-document-thumb.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
. ./credentials
DOCID=19263
curl -L --silent "${URL}/fetch/thumb/${DOCID}" -H "Authorization: ${AUTH}" --output ${DOCID}.png

6
tests/test-documents.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
. ./credentials
curl --silent "${URL}/api/documents/?format=json&query=added:%5B-70%20day%20to%20now%5D&is_tagged=0&page=3&page_size=5&ordering=-added" -H "Authorization: ${AUTH}" | jq '.'
#curl --silent "${URL}/api/documents/?format=json&query=barbaradio&page=3&page_size=5&ordering=-added" -H "Authorization: ${AUTH}" | jq '.'

10
tests/test-post-saved-view.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
. ./credentials
curl --silent -X POST "${URL}/api/saved_views/" \
-H 'Content-Type: application/json' \
-H "Authorization: ${AUTH}" \
-d '{"id":0,"name":"autoview","username":"admin","password":"admin"}'
# | jq '.'

6
tests/test-saved-views.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
. ./credentials
curl --silent "${URL}/api/saved_views/" -H "Authorization: ${AUTH}" | jq '.'

6
tests/test-statstotal.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
. ./credentials
curl --silent "${URL}/api/statstotal/" -H "Authorization: ${AUTH}" | jq '.'

7
tests/test-tags.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
. ./credentials
curl --silent "${URL}/api/tags/" -H "Authorization: ${AUTH}"
#| jq '.'

8
tests/test-token.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
. ./credentials
curl --silent -X POST "${URL}/api/token/" \
-H 'Content-Type: application/json' \
-d '{"username":"admin","password":"admin"}' | jq '.'

7
tests/test-upload.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
. ./credentials
curl -v -X POST -F "file=@test-upload.sh" -F "tags=5" "${URL}/api/documents/post_document/" -H "Authorization: ${AUTH}"
#| jq '.'