forked from smart-on-fhir/client-py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_models.sh
executable file
·30 lines (24 loc) · 899 Bytes
/
test_models.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# set this to a relative path, from inside the fhirclient/models directory, to the downloaded FHIR spec directory
export FHIR_UNITTEST_DATADIR="../fhir-parser/downloads"
cd fhirclient
if [ ! -e $FHIR_UNITTEST_DATADIR ]; then
echo Unit tests depend on the downloaded FHIR spec, which is not present at $FHIR_UNITTEST_DATADIR. Cannot run unit tests.
exit 1
fi
echo 'import isodate' | python 2>/dev/null
if [ $? -ne 0 ]; then
echo You need to have the 'isodate' module installed in order to run the tests
exit 1
fi
#python -m unittest discover ./models '*_tests.py' # ImportError
tests=(models/*_tests.py)
python -m unittest ${tests[@]}
# couple of custom tests
echo 'import requests' | python 2>/dev/null
if [ $? -eq 0 ]; then
python -m unittest server_tests.py fhirreference_tests.py
else
echo "You don't have the 'requests' module installed, will skip extra tests"
fi
cd ..