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
5a37d055
Commit
5a37d055
authored
Apr 26, 2017
by
Łukasz Nowak
Committed by
Rafael Monnerat
Apr 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playbook: Add tests for standalone-shared
Those tests are used by deploy-test ERP5TestNode testsuite.
parent
b7f1aeea
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
0 deletions
+83
-0
playbook/roles/standalone-shared/setup.py
playbook/roles/standalone-shared/setup.py
+10
-0
playbook/roles/standalone-shared/tests/__init__.py
playbook/roles/standalone-shared/tests/__init__.py
+0
-0
playbook/roles/standalone-shared/tests/testSiteHttp.py
playbook/roles/standalone-shared/tests/testSiteHttp.py
+20
-0
playbook/roles/standalone-shared/tests/testSiteHttps.py
playbook/roles/standalone-shared/tests/testSiteHttps.py
+29
-0
playbook/roles/standalone-shared/tests/testSiteStatus.py
playbook/roles/standalone-shared/tests/testSiteStatus.py
+24
-0
No files found.
playbook/roles/standalone-shared/setup.py
0 → 100644
View file @
5a37d055
from
setuptools
import
setup
,
find_packages
version
=
'0.0'
name
=
'standalone-shared-tests'
setup
(
name
=
name
,
version
=
version
,
tests_require
=
[
'requests'
],
test_suite
=
'tests'
)
playbook/roles/standalone-shared/tests/__init__.py
0 → 100644
View file @
5a37d055
playbook/roles/standalone-shared/tests/testSiteHttp.py
0 → 100644
View file @
5a37d055
import
requests
import
unittest
import
os
class
TestSiteHttp
(
unittest
.
TestCase
):
"""Check that configuration generated in the machine works"""
def
setUp
(
self
):
self
.
http_url
=
os
.
environ
[
'TEST_ACCESS_URL_HTTP'
]
self
.
https_url
=
os
.
environ
[
'TEST_ACCESS_URL_HTTPS'
]
def
test_http_erp5_login_form
(
self
):
"""Check that accessing site over HTTP redirects to HTTPS"""
result
=
requests
.
get
(
self
.
http_url
+
'/erp5/login_form'
,
verify
=
False
)
self
.
assertTrue
(
result
.
ok
)
self
.
assertTrue
(
result
.
is_redirect
)
self
.
assertTrue
(
result
.
is_permanent_redirect
)
self
.
assertEqual
(
result
.
status_code
,
302
)
self
.
assertTrue
(
result
.
headers
[
'Location'
].
endswith
(
'/erp5/login_form'
))
self
.
assertTrue
(
result
.
headers
[
'Location'
].
startswith
(
'https://'
))
playbook/roles/standalone-shared/tests/testSiteHttps.py
0 → 100644
View file @
5a37d055
import
requests
import
unittest
import
os
class
TestSiteHttps
(
unittest
.
TestCase
):
"""Check that configuration generated in the machine works"""
def
setUp
(
self
):
self
.
http_url
=
os
.
environ
[
'TEST_ACCESS_URL_HTTP'
]
self
.
https_url
=
os
.
environ
[
'TEST_ACCESS_URL_HTTPS'
]
def
test_https_erp5_login_form
(
self
):
"""Check that accessing login_form over HTTPS works"""
result
=
requests
.
get
(
self
.
https_url
+
'/erp5/login_form'
,
verify
=
False
)
self
.
assertTrue
(
result
.
ok
)
self
.
assertFalse
(
result
.
is_redirect
)
self
.
assertFalse
(
result
.
is_permanent_redirect
)
self
.
assertEqual
(
result
.
status_code
,
200
)
self
.
assertTrue
(
'ERP5 Free Open Source ERP and CRM'
in
result
.
text
)
def
test_https_erp5
(
self
):
"""Check that accessing site over HTTPS redirects to login_form"""
result
=
requests
.
get
(
self
.
https_url
+
'/erp5/'
,
verify
=
False
,
allow_redirects
=
False
)
self
.
assertTrue
(
result
.
ok
)
self
.
assertTrue
(
result
.
is_redirect
)
self
.
assertFalse
(
result
.
is_permanent_redirect
)
self
.
assertEqual
(
result
.
status_code
,
302
)
self
.
assertTrue
(
result
.
headers
[
'Location'
].
endswith
(
'/erp5/login_form'
))
playbook/roles/standalone-shared/tests/testSiteStatus.py
0 → 100644
View file @
5a37d055
import
unittest
import
os
import
json
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
))
def
test_build
(
self
):
"""Checks that site was correctly created"""
# expose output for debugging
print
'Standard output:'
print
self
.
status_dict
[
'stdout'
]
print
'Standard error:'
print
self
.
status_dict
[
'stderr'
]
# Assert success
self
.
assertTrue
(
self
.
status_dict
[
'success'
])
def
test_build_time_less_6h
(
self
):
# Check that site was built in less than 6h
self
.
assertLess
(
self
.
status_dict
[
'duration'
],
(
3600.
*
6
))
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