-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
preparing to add additional endpoints and start of tests (#4)
* preparing to add additional endpoints and start of tests Signed-off-by: vsoch <vsoch@users.noreply.github.com>
- Loading branch information
Showing
15 changed files
with
296 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
__author__ = "Vanessa Sochat" | ||
__copyright__ = "Copyright 2022, Vanessa Sochat" | ||
__license__ = "MPL 2.0" | ||
|
||
import usrse.main.endpoints as endpoints | ||
|
||
|
||
def main(args, parser, extra, subparser): | ||
for endpoint in endpoints.register_names: | ||
print(endpoint) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
runTest() { | ||
|
||
# The first argument is the code we should get | ||
ERROR="${1:-}" | ||
shift | ||
OUTPUT=${1:-} | ||
shift | ||
echo "$@" | ||
|
||
"$@" > "${OUTPUT}" 2>&1 | ||
RETVAL="$?" | ||
|
||
if [ "$ERROR" = "0" -a "$RETVAL" != "0" ]; then | ||
echo "$@ (retval=$RETVAL) ERROR" | ||
cat ${OUTPUT} | ||
echo "Output in ${OUTPUT}" | ||
exit 1 | ||
elif [ "$ERROR" != "0" -a "$RETVAL" = "0" ]; then | ||
echo "$@ (retval=$RETVAL) ERROR" | ||
echo "Output in ${OUTPUT}" | ||
cat ${OUTPUT} | ||
exit 1 | ||
else | ||
echo "$@ (retval=$RETVAL) OK" | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/python | ||
|
||
# Copyright (C) 2022 Vanessa Sochat. | ||
|
||
# This Source Code Form is subject to the terms of the | ||
# Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed | ||
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
import pytest | ||
import os | ||
|
||
import usrse.main.endpoints as endpoints | ||
from usrse.main import Client | ||
|
||
here = os.path.dirname(os.path.abspath(__file__)) | ||
root = os.path.dirname(here) | ||
|
||
tests = [(ep, item) for ep in endpoints.register_names for item in [True, False]] | ||
|
||
|
||
@pytest.mark.parametrize("endpoint,is_live", tests) | ||
def test_install_get(tmp_path, endpoint, is_live): | ||
"""Test install and get""" | ||
client = Client(quiet=False) | ||
result = client.get(endpoint) | ||
if is_live: | ||
result.table_live() | ||
else: | ||
result.table() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
echo | ||
echo "************** START: test_client.sh **********************" | ||
|
||
# Create temporary testing directory | ||
echo "Creating temporary directory to work in." | ||
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
shpc_root="$( dirname "${here}" )" | ||
|
||
. $here/helpers.sh | ||
|
||
# Create temporary testing directory | ||
tmpdir=$(mktemp -d) | ||
output=$(mktemp ${tmpdir:-/tmp}/usrse_test.XXXXXX) | ||
printf "Created temporary directory to work in. ${tmpdir}\n" | ||
|
||
# Make sure it's installed | ||
if ! command -v usrse &> /dev/null | ||
then | ||
printf "usrse is not installed\n" | ||
exit 1 | ||
else | ||
printf "usrse is installed\n" | ||
fi | ||
|
||
echo | ||
echo "#### Testing base client " | ||
runTest 0 $output usrse --version | ||
|
||
echo | ||
echo "#### Testing list " | ||
runTest 0 $output usrse list --help | ||
runTest 0 $output usrse list | ||
|
||
|
||
echo | ||
echo "#### Testing get " | ||
runTest 0 $output usrse get --help | ||
for endpoint in $(usrse list); do | ||
runTest 0 $output usrse get $endpoint | ||
runTest 0 $output usrse get $endpoint --live | ||
done | ||
|
||
rm -rf ${tmpdir} |
Oops, something went wrong.