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

This commit is contained in:
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"
ran=0;
#for f in tests/browser-tests/*.py; do
# python3 "$f" || close # if needed
# let "ran++"
#done
#echo "ran $ran browser tests."
for f in tests/browser-tests/*.py; do
python3 "$f" || close # if needed
let "ran++"
done
echo "ran $ran browser tests."
echo "total test time $SECONDS"

View File

@ -17,6 +17,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
var notificationSetting = document.getElementById('notificationSetting')
var sigSetting = document.getElementById('mailSignatureSetting')
document.getElementById('forwardSecrecySetting').onchange = function(e){
postData = JSON.stringify({"default_forward_secrecy": e.target.checked})
fetch('/config/set/mail', {
@ -56,11 +58,27 @@ notificationSetting.onchange = function(e){
"content-type": "application/json",
"token": webpass
}})
.then((resp) => resp.text())
.then(function(data) {
mailSettings['notificationSetting'] = notificationSetting.checked
PNotify.success({
text: 'Successfully toggled default mail notifications'
})
})
}
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
sys.path.append(".")
sys.path.append("src/")
import unittest, uuid
TEST_DIR = 'testdata/-%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
os.environ["ONIONR_HOME"] = TEST_DIR
from unittest.mock import patch
from utils import createdirs
@ -34,8 +34,9 @@ class OnionrTests(unittest.TestCase):
sleep(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)
if Text('Get Started').exists():
if not Text('Circles').exists():
click('Get Started')
sleep(2)
click('Circles')
sleep(5)
if not Text('Circle Name').exists():
@ -45,6 +46,4 @@ class OnionrTests(unittest.TestCase):
Popen(['./onionr.sh', 'stop']).wait()
web_driver.quit()
unittest.main()

View File

@ -1 +1 @@
1583304780
1583317276