reenabled browser tests, added mail test, work on mail signatures

master
Kevin Froman 2020-03-04 04:29:28 -06:00
parent 60d2ebfaed
commit 4516cdee24
4 changed files with 28 additions and 11 deletions

View File

@ -24,9 +24,9 @@ echo "ran $ran integration tests."
echo "total test time $SECONDS" echo "total test time $SECONDS"
ran=0; ran=0;
#for f in tests/browser-tests/*.py; do for f in tests/browser-tests/*.py; do
# python3 "$f" || close # if needed python3 "$f" || close # if needed
# let "ran++" let "ran++"
#done done
#echo "ran $ran browser tests." echo "ran $ran browser tests."
echo "total test time $SECONDS" echo "total test time $SECONDS"

View File

@ -17,6 +17,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
var notificationSetting = document.getElementById('notificationSetting') var notificationSetting = document.getElementById('notificationSetting')
var sigSetting = document.getElementById('mailSignatureSetting')
document.getElementById('forwardSecrecySetting').onchange = function(e){ document.getElementById('forwardSecrecySetting').onchange = function(e){
postData = JSON.stringify({"default_forward_secrecy": e.target.checked}) postData = JSON.stringify({"default_forward_secrecy": e.target.checked})
fetch('/config/set/mail', { fetch('/config/set/mail', {
@ -56,7 +58,6 @@ notificationSetting.onchange = function(e){
"content-type": "application/json", "content-type": "application/json",
"token": webpass "token": webpass
}}) }})
.then((resp) => resp.text())
.then(function(data) { .then(function(data) {
mailSettings['notificationSetting'] = notificationSetting.checked mailSettings['notificationSetting'] = notificationSetting.checked
PNotify.success({ PNotify.success({
@ -64,3 +65,20 @@ notificationSetting.onchange = function(e){
}) })
}) })
} }
sigSetting.onchange = function(){
var postData = JSON.stringify({"signature": sigSetting.value})
fetch('/config/set/mail', {
method: 'POST',
body: postData,
headers: {
"content-type": "application/json",
"token": webpass
}})
.then(function(data) {
mailSettings['signature'] = sigSetting.value
PNotify.success({
text: 'Set mail signature'
})
})
}

View File

@ -1,10 +1,10 @@
from unittest.mock import patch
import sys, os import sys, os
sys.path.append(".") sys.path.append(".")
sys.path.append("src/") sys.path.append("src/")
import unittest, uuid import unittest, uuid
TEST_DIR = 'testdata/-%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/' TEST_DIR = 'testdata/-%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
os.environ["ONIONR_HOME"] = TEST_DIR os.environ["ONIONR_HOME"] = TEST_DIR
from unittest.mock import patch
from utils import createdirs from utils import createdirs
@ -34,8 +34,9 @@ class OnionrTests(unittest.TestCase):
sleep(1) sleep(1)
url = 'http' + escapeansi.escape_ANSI(Popen(['./onionr.sh', 'url'], stdout=subprocess.PIPE).communicate()[0].decode().split('http')[1]) url = 'http' + escapeansi.escape_ANSI(Popen(['./onionr.sh', 'url'], stdout=subprocess.PIPE).communicate()[0].decode().split('http')[1])
web_driver = start_firefox(url=url, headless=BROWSER_HEADLESS) web_driver = start_firefox(url=url, headless=BROWSER_HEADLESS)
if Text('Get Started').exists(): if not Text('Circles').exists():
click('Get Started') click('Get Started')
sleep(2)
click('Circles') click('Circles')
sleep(5) sleep(5)
if not Text('Circle Name').exists(): if not Text('Circle Name').exists():
@ -45,6 +46,4 @@ class OnionrTests(unittest.TestCase):
Popen(['./onionr.sh', 'stop']).wait() Popen(['./onionr.sh', 'stop']).wait()
web_driver.quit() web_driver.quit()
unittest.main() unittest.main()

View File

@ -1 +1 @@
1583304780 1583317276