Commit 376c3aec by Bruno Bzeznik

Working test example with python-webtest

parent 7cc89d4d
......@@ -16,7 +16,7 @@ run() {
# Main setup
nixos-container start $container
init_script=`nix-store --add store/init.sh`
init_script=`nix-store --add store/init-phylodb.sh`
source_dir=`nix-store --add $source_dir`
run mkdir -p /var/lib/phyloalps/phylodb
run cp -a $source_dir/* /var/lib/phyloalps/phylodb/
......
#!/usr/bin/env bash
container=phylotest
run() {
nixos-container run $container -- $*
}
# Main setup
nixos-container start $container
init_script=`nix-store --add store/init-phylotest.sh`
test_script=`nix-store --add store/phylo-webtests.py`
run mkdir -p /var/lib/phylotest
run cp $test_script /var/lib/phylotest/
run bash $init_script
......@@ -23,6 +23,11 @@
(python36.withPackages(ps: with ps; [pip virtualenv psycopg2 urllib3 requests]))
];
networking.hosts = {
"127.0.0.1" = [ "localhost" "data.phylodev.org" ];
"::1" = [ "localhost" ];
};
networking.nat.enable = true;
services.openssh.enable = true;
services.postgresql = {
......
{ config, pkgs, ... }:
{
containers.phylotest =
{ config =
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
coreutils
findutils
su
vim
(python36.withPackages(ps: with ps; [pip virtualenv webtest]))
];
services.openssh.enable = true;
users.extraUsers.phyloalps = {
isNormalUser = true;
};
};
};
}
#!/usr/bin/env bash
LIB_DIR=/var/lib
PHYLOTEST_DIR=$LIB_DIR/phylotest
# Django-webtest install
cd $PHYLOTEST_DIR
if [ \! -d django-webtest ]
then
virtualenv -p python3 django-webtest
fi
source django-webtest/bin/activate
pip install django-webtest
from webtest import TestApp
app = TestApp('http://data.phylodev.org#urllib3')
resp = app.get('/home/login/?next=/browse/project/PHA/sample/969/')
form = resp.form
form['username'] = 'admin'
form['password'] = 'phylodev'
resp = form.submit().follow()
assert 'Asplenium lepidum' in resp
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment