Compare commits
2 Commits
develop-ap
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
059a54bcfb | 1 month ago |
|
|
b44526f5cb | 1 month ago |
14 changed files with 190 additions and 45 deletions
@ -1,13 +1,20 @@
|
||||
#!/usr/bin/env bash |
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) |
||||
cd "$SCRIPT_DIR" |
||||
|
||||
if [ -z "$TEST_SERVER_ADDRESS" ]; then |
||||
source export.sh |
||||
fi |
||||
|
||||
tavern-ci --alluredir=reports test_plans/info_test.tavern.yaml |
||||
tavern-ci --alluredir=reports test_plans/version_test.tavern.yaml |
||||
# tavern-ci --alluredir=reports test_plans/auth_test.tavern.yaml |
||||
tavern-ci --alluredir=reports test_plans/decode_test.tavern.yaml |
||||
tavern-ci --alluredir=reports test_plans/dictionary_test.tavern.yaml |
||||
tavern-ci --alluredir=reports test_plans/encode_test.tavern.yaml |
||||
|
||||
if command -v allure > /dev/null; then |
||||
allure generate --clean --single-file --output /tmp/vm-allure-report --name index.html reports |
||||
fi |
||||
# if command -v allure > /dev/null; then |
||||
# allure generate --clean --single-file --output /tmp/vm-allure-report --name index.html reports |
||||
# fi |
||||
|
||||
# allure package: https://github.com/allure-framework/allure2/releases/download/2.34.0/allure_2.34.0-1_all.deb |
||||
|
||||
@ -0,0 +1,29 @@
|
||||
test_name: "Test major decode endpoint" |
||||
|
||||
includes: |
||||
- !include includes.yaml |
||||
|
||||
stages: |
||||
|
||||
- name: "Successful decode with valid encoded input" |
||||
request: |
||||
url: "http://{server_address}/{api_base}/major/decode/pl/test" |
||||
method: GET |
||||
headers: |
||||
X-API-Key: "{api_key}" |
||||
response: |
||||
strict: True |
||||
status_code: 200 |
||||
json: |
||||
input: "test" |
||||
result: "101" |
||||
|
||||
- name: "Missing authentication returns 401 error" |
||||
request: |
||||
url: "http://{server_address}/{api_base}/major/decode/pl/hello" |
||||
method: GET |
||||
response: |
||||
strict: False |
||||
status_code: 401 |
||||
json: |
||||
error: !anystr |
||||
@ -0,0 +1,30 @@
|
||||
test_name: "Test dictionary API endpoint" |
||||
|
||||
includes: |
||||
- !include includes.yaml |
||||
|
||||
stages: |
||||
|
||||
- name: "Successful list dictionaries with valid authentication" |
||||
request: |
||||
url: "http://{server_address}/{api_base}/dicts" |
||||
method: GET |
||||
headers: |
||||
X-API-Key: "{api_key}" |
||||
response: |
||||
strict: False |
||||
status_code: 200 |
||||
json: |
||||
dictionaries: |
||||
- name: !anystr |
||||
entry_count: !anyint |
||||
|
||||
- name: "Missing authentication returns 401 error" |
||||
request: |
||||
url: "http://{server_address}/{api_base}/dicts" |
||||
method: GET |
||||
response: |
||||
strict: True |
||||
status_code: 401 |
||||
json: |
||||
error: !anystr |
||||
@ -0,0 +1,44 @@
|
||||
test_name: "Test major encode endpoint" |
||||
|
||||
includes: |
||||
- !include includes.yaml |
||||
|
||||
stages: |
||||
|
||||
- name: "Successful encode with default dictionary" |
||||
request: |
||||
url: "http://{server_address}/{api_base}/major/encode/pl/hello" |
||||
method: GET |
||||
headers: |
||||
X-API-Key: "{api_key}" |
||||
response: |
||||
strict: False |
||||
status_code: 200 |
||||
json: |
||||
input: "hello" |
||||
dict: "demo_pl" |
||||
result: !anylist |
||||
|
||||
- name: "Successful encode with custom dictionary" |
||||
request: |
||||
url: "http://{server_address}/{api_base}/major/encode/pl/test?dict=demo_pl" |
||||
method: GET |
||||
headers: |
||||
X-API-Key: "{api_key}" |
||||
response: |
||||
strict: False |
||||
status_code: 200 |
||||
json: |
||||
input: "test" |
||||
dict: "demo_pl" |
||||
result: !anylist |
||||
|
||||
- name: "Missing authentication returns 401 error" |
||||
request: |
||||
url: "http://{server_address}/{api_base}/major/encode/pl/hello" |
||||
method: GET |
||||
response: |
||||
strict: False |
||||
status_code: 401 |
||||
json: |
||||
error: !anystr |
||||
@ -1,19 +0,0 @@
|
||||
test_name: "Test server API info endpoint" |
||||
|
||||
includes: |
||||
- !include includes.yaml |
||||
|
||||
stages: |
||||
- name: "Check version" |
||||
request: |
||||
url: "http://{server_address}/{api_base}/info/version" |
||||
method: GET |
||||
headers: |
||||
X-API-Key: "{api_key}" |
||||
response: |
||||
strict: False |
||||
status_code: 200 |
||||
json: |
||||
name: !anystr |
||||
version: !anystr |
||||
|
||||
@ -0,0 +1,20 @@
|
||||
test_name: "Test version endpoint" |
||||
|
||||
includes: |
||||
- !include includes.yaml |
||||
|
||||
stages: |
||||
- name: "Successful version test - valid authentication returns version info" |
||||
request: |
||||
url: "http://{server_address}/api/v1/info/version" |
||||
method: GET |
||||
headers: |
||||
X-API-Key: "{api_key}" |
||||
response: |
||||
strict: True |
||||
status_code: 200 |
||||
json: |
||||
name: "phomnemic-server" |
||||
version: !anystr |
||||
|
||||
|
||||
Loading…
Reference in new issue