mirror of
https://github.com/SaraSmiseth/prosody.git
synced 2025-05-04 13:10:38 +00:00
Create tests (#15)
Created a tests folder which contains pytest and bats tests. Pytest is used to login and send messages to other accounts. Bats is used to check the log for debug messages. This fixes #13.
This commit is contained in:
parent
fc45a7bab1
commit
b70fcbd98e
12 changed files with 353 additions and 1 deletions
45
tests/test.bash
Executable file
45
tests/test.bash
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# generate certs for testing
|
||||
|
||||
generateCert() {
|
||||
DOMAIN="$1"
|
||||
if [[ ! -d certs/"$DOMAIN" ]] ; then
|
||||
mkdir -p certs/"$DOMAIN"
|
||||
cd certs/"$DOMAIN"
|
||||
openssl req -x509 -newkey rsa:4096 -keyout privkey.pem -out fullchain.pem -days 365 -subj "/CN=$DOMAIN" -nodes
|
||||
chmod 777 *.pem
|
||||
cd ../../
|
||||
fi
|
||||
}
|
||||
|
||||
generateCert "localhost"
|
||||
generateCert "conference.localhost"
|
||||
generateCert "proxy.localhost"
|
||||
generateCert "pubsub.localhost"
|
||||
generateCert "upload.localhost"
|
||||
|
||||
sudo docker-compose down \
|
||||
&& sudo docker-compose up -d \
|
||||
\
|
||||
&& sudo docker exec tests_prosody_1 /bin/bash -c "/entrypoint.sh register admin localhost 12345678" \
|
||||
&& sudo docker exec tests_prosody_1 /bin/bash -c "/entrypoint.sh register user1 localhost 12345678" \
|
||||
&& sudo docker exec tests_prosody_1 /bin/bash -c "/entrypoint.sh register user2 localhost 12345678" \
|
||||
&& sudo docker exec tests_prosody_1 /bin/bash -c "/entrypoint.sh register user3 localhost 12345678" \
|
||||
\
|
||||
&& python --version \
|
||||
&& python3 --version \
|
||||
&& python3 -m venv venv \
|
||||
&& source venv/bin/activate \
|
||||
&& python --version \
|
||||
&& pip --version \
|
||||
&& pip install -r requirements.txt \
|
||||
&& pytest \
|
||||
&& deactivate \
|
||||
&& sleep 5 \
|
||||
&& sudo docker-compose logs \
|
||||
&& ./bats/bats-core/bin/bats tests.bats
|
||||
|
||||
sudo docker-compose down
|
Loading…
Add table
Add a link
Reference in a new issue