summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-12-22 15:00:33 +0100
committerKali Kaneko (leap communications) <kali@leap.se>2016-12-26 14:55:40 +0100
commitf98af5593c41ce7dd826b491b3aa3953922d60f9 (patch)
treeac63abda33d8b5e6aeb808886526ccab8acf3b1c
parent6a1ca30602f82e29fff9a50403a8c030ca888a75 (diff)
[feat] serial script to create and auth user
-rw-r--r--Makefile3
-rwxr-xr-xtests/e2e/e2e-test.sh42
2 files changed, 45 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 601f3fa..8449551 100644
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,9 @@ dev-all:
uninstall:
pip uninstall leap.bitmask
+test_e2e:
+ tests/e2e/e2e-test.sh
+
qt-resources:
pyrcc5 pkg/branding/icons.qrc -o src/leap/bitmask/gui/app_rc.py
diff --git a/tests/e2e/e2e-test.sh b/tests/e2e/e2e-test.sh
new file mode 100755
index 0000000..39eb200
--- /dev/null
+++ b/tests/e2e/e2e-test.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+set -x
+set -e
+
+PROVIDER='cdev.bitmask.net'
+BCTL='bitmaskctl'
+LEAP_HOME='~/.config/leap'
+username="tmp_user_$(date +%Y%m%d%H%M%S)"
+user="${username}@${PROVIDER}"
+pw="$(head -c 10 < /dev/urandom | base64)"
+
+# Stop any previously started bitmaskd
+# and start a new instance
+"$BCTL" stop
+
+rm -rf $LEAP_HOME
+
+"$BCTL" start
+
+
+# Register a new user
+"$BCTL" user create "$user" --pass "$pw"
+
+# Authenticate
+"$BCTL" user auth "$user" --pass "$pw"
+
+# Note that imap_pw is the same for smtp
+
+imap_pw="None"
+
+# FIXME -- this would be prettier if we had the auth command block on
+# the first-time run, so that we just return when the key has been generated
+# and explicitely raise any error found
+
+while [[ $imap_pw == *"None"* ]]; do
+ response=$("$BCTL" mail get_token)
+ sleep 2
+ imap_pw=$(echo $response | head -n 1 | sed 's/ */ /g' | cut -d' ' -f 2)
+done
+
+echo "IMAP/SMTP PASSWD: $imap_pw"