Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
slapos.package
Commits
7976a111
Commit
7976a111
authored
Sep 15, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
standalone-shared/tests: modernize a bit
parent
ceee9b15
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
playbook/roles/standalone-shared/tests/testSiteHttps.py
playbook/roles/standalone-shared/tests/testSiteHttps.py
+1
-1
playbook/roles/standalone-shared/tests/testSiteStatus.py
playbook/roles/standalone-shared/tests/testSiteStatus.py
+9
-6
No files found.
playbook/roles/standalone-shared/tests/testSiteHttps.py
View file @
7976a111
...
@@ -29,7 +29,7 @@ class TestSiteHttps(unittest.TestCase):
...
@@ -29,7 +29,7 @@ class TestSiteHttps(unittest.TestCase):
),
),
result
.
content
result
.
content
)
)
self
.
assert
True
(
'ERP5 Free Open Source ERP and CRM'
in
result
.
text
)
self
.
assert
In
(
'ERP5 Free Open Source ERP and CRM'
,
result
.
text
)
def
test_https_erp5
(
self
):
def
test_https_erp5
(
self
):
"""Check that accessing site over HTTPS redirects to login_form"""
"""Check that accessing site over HTTPS redirects to login_form"""
...
...
playbook/roles/standalone-shared/tests/testSiteStatus.py
View file @
7976a111
import
unittest
import
unittest
import
datetime
import
os
import
os
import
json
import
json
...
@@ -7,18 +8,20 @@ class TestSiteStatus(unittest.TestCase):
...
@@ -7,18 +8,20 @@ class TestSiteStatus(unittest.TestCase):
"""Asserts site status"""
"""Asserts site status"""
def
setUp
(
self
):
def
setUp
(
self
):
self
.
site_status_json
=
os
.
environ
[
'TEST_SITE_STATUS_JSON'
]
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
):
def
test_build
(
self
):
"""Checks that site was correctly created"""
"""Checks that site was correctly created"""
# expose output for debugging
# expose output for debugging
print
(
'Standard output:'
)
print
(
'Standard output:'
)
print
(
self
.
status_dict
[
'stdout'
]
.
encode
(
'utf-8'
)
)
print
(
self
.
status_dict
[
'stdout'
])
print
(
'Standard error:'
)
print
(
'Standard error:'
)
print
(
self
.
status_dict
[
'stderr'
].
encode
(
'utf-8'
))
print
(
self
.
status_dict
[
'stderr'
])
# Assert success
self
.
assertTrue
(
self
.
status_dict
[
'success'
])
self
.
assertTrue
(
self
.
status_dict
[
'success'
])
def
test_build_time
(
self
):
def
test_build_time
(
self
):
"""Asserts that site was built in less than 13h"""
"""Asserts that site was built in acceptable time"""
self
.
assertLess
(
self
.
status_dict
[
'duration'
],
(
3600.
*
13
))
self
.
assertLess
(
self
.
status_dict
[
'duration'
],
datetime
.
timedelta
(
hours
=
13
).
total_seconds
())
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment