Commit 7976a111 authored by Jérome Perrin's avatar Jérome Perrin

standalone-shared/tests: modernize a bit

parent ceee9b15
......@@ -29,7 +29,7 @@ class TestSiteHttps(unittest.TestCase):
),
result.content
)
self.assertTrue('ERP5 Free Open Source ERP and CRM' in result.text)
self.assertIn('ERP5 Free Open Source ERP and CRM', result.text)
def test_https_erp5(self):
"""Check that accessing site over HTTPS redirects to login_form"""
......
import unittest
import datetime
import os
import json
......@@ -7,18 +8,20 @@ class TestSiteStatus(unittest.TestCase):
"""Asserts site status"""
def setUp(self):
self.site_status_json = os.environ['TEST_SITE_STATUS_JSON']
self.status_dict = json.load(open(self.site_status_json))
with open(self.site_status_json) as f:
self.status_dict = json.load(f)
def test_build(self):
"""Checks that site was correctly created"""
# expose output for debugging
print('Standard output:')
print(self.status_dict['stdout'].encode('utf-8'))
print(self.status_dict['stdout'])
print('Standard error:')
print(self.status_dict['stderr'].encode('utf-8'))
# Assert success
print(self.status_dict['stderr'])
self.assertTrue(self.status_dict['success'])
def test_build_time(self):
"""Asserts that site was built in less than 13h"""
self.assertLess(self.status_dict['duration'], (3600. * 13))
"""Asserts that site was built in acceptable time"""
self.assertLess(
self.status_dict['duration'],
datetime.timedelta(hours=13).total_seconds())
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