Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Léo-Paul Géneau
slapos.core
Commits
ee9d7ce3
Commit
ee9d7ce3
authored
Nov 13, 2014
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_hypermedia: use ERP5Site_reindexSkinList and (more) changeSkin in tests.
parent
926a0b4e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
master/bt5/slapos_hypermedia/TestTemplateItem/testSlapOSHypermediaScenario.py
...permedia/TestTemplateItem/testSlapOSHypermediaScenario.py
+12
-3
master/bt5/slapos_hypermedia/TestTemplateItem/testSlapOSHypermediaSkins.py
..._hypermedia/TestTemplateItem/testSlapOSHypermediaSkins.py
+10
-0
No files found.
master/bt5/slapos_hypermedia/TestTemplateItem/testSlapOSHypermediaScenario.py
View file @
ee9d7ce3
...
@@ -46,6 +46,11 @@ class TestSlapOSHypermediaPersonScenario(testSlapOSMixin):
...
@@ -46,6 +46,11 @@ class TestSlapOSHypermediaPersonScenario(testSlapOSMixin):
def
test
(
self
):
def
test
(
self
):
erp5_person
=
self
.
_makeUser
()
erp5_person
=
self
.
_makeUser
()
self
.
tic
()
self
.
portal
.
changeSkin
(
'Hal'
)
self
.
portal
.
ERP5Site_reindexSkinList
()
self
.
tic
()
authorization
=
'Basic %s'
%
base64
.
b64encode
(
authorization
=
'Basic %s'
%
base64
.
b64encode
(
"%s:%s"
%
(
erp5_person
.
getReference
(),
erp5_person
.
getReference
()))
"%s:%s"
%
(
erp5_person
.
getReference
(),
erp5_person
.
getReference
()))
content_type
=
"application/hal+json"
content_type
=
"application/hal+json"
...
@@ -406,6 +411,9 @@ class TestSlapOSHypermediaInstanceScenario(testSlapOSMixin):
...
@@ -406,6 +411,9 @@ class TestSlapOSHypermediaInstanceScenario(testSlapOSMixin):
def
test
(
self
):
def
test
(
self
):
self
.
_makeTree
()
self
.
_makeTree
()
instance
=
self
.
software_instance
instance
=
self
.
software_instance
self
.
portal
.
changeSkin
(
'Hal'
)
self
.
portal
.
ERP5Site_reindexSkinList
()
self
.
tic
()
remote_user
=
instance
.
getReference
()
remote_user
=
instance
.
getReference
()
content_type
=
"application/hal+json"
content_type
=
"application/hal+json"
...
@@ -615,3 +623,4 @@ class TestSlapOSHypermediaInstanceScenario(testSlapOSMixin):
...
@@ -615,3 +623,4 @@ class TestSlapOSHypermediaInstanceScenario(testSlapOSMixin):
self
.
assertEquals
(
response
.
status
,
200
)
self
.
assertEquals
(
response
.
status
,
200
)
self
.
assertEquals
(
response
.
getheader
(
'Content-Type'
),
content_type
)
self
.
assertEquals
(
response
.
getheader
(
'Content-Type'
),
content_type
)
instance_hal
=
json
.
loads
(
response
.
read
())
instance_hal
=
json
.
loads
(
response
.
read
())
master/bt5/slapos_hypermedia/TestTemplateItem/testSlapOSHypermediaSkins.py
View file @
ee9d7ce3
...
@@ -80,6 +80,7 @@ class ERP5HALJSONStyleSkinsMixin(ERP5TypeTestCase):
...
@@ -80,6 +80,7 @@ class ERP5HALJSONStyleSkinsMixin(ERP5TypeTestCase):
class
TestBase_getRequestHeader
(
ERP5HALJSONStyleSkinsMixin
):
class
TestBase_getRequestHeader
(
ERP5HALJSONStyleSkinsMixin
):
def
test_getRequestHeader_REQUEST_disallowed
(
self
):
def
test_getRequestHeader_REQUEST_disallowed
(
self
):
self
.
changeSkin
(
'Hal'
)
self
.
assertRaises
(
self
.
assertRaises
(
Unauthorized
,
Unauthorized
,
self
.
portal
.
Base_getRequestHeader
,
self
.
portal
.
Base_getRequestHeader
,
...
@@ -87,12 +88,14 @@ class TestBase_getRequestHeader(ERP5HALJSONStyleSkinsMixin):
...
@@ -87,12 +88,14 @@ class TestBase_getRequestHeader(ERP5HALJSONStyleSkinsMixin):
REQUEST
=
{})
REQUEST
=
{})
def
test_getRequestHeader_key_error
(
self
):
def
test_getRequestHeader_key_error
(
self
):
self
.
changeSkin
(
'Hal'
)
self
.
assertEquals
(
self
.
assertEquals
(
self
.
portal
.
Base_getRequestHeader
(
'foo'
),
self
.
portal
.
Base_getRequestHeader
(
'foo'
),
None
None
)
)
def
test_getRequestHeader_default_value
(
self
):
def
test_getRequestHeader_default_value
(
self
):
self
.
changeSkin
(
'Hal'
)
self
.
assertEquals
(
self
.
assertEquals
(
self
.
portal
.
Base_getRequestHeader
(
'foo'
,
default
=
'bar'
),
self
.
portal
.
Base_getRequestHeader
(
'foo'
,
default
=
'bar'
),
'bar'
'bar'
...
@@ -105,6 +108,7 @@ class TestBase_getRequestHeader(ERP5HALJSONStyleSkinsMixin):
...
@@ -105,6 +108,7 @@ class TestBase_getRequestHeader(ERP5HALJSONStyleSkinsMixin):
# XXX to be migrated to erp5_hal_json_style bt
# XXX to be migrated to erp5_hal_json_style bt
class
TestBase_getRequestUrl
(
ERP5HALJSONStyleSkinsMixin
):
class
TestBase_getRequestUrl
(
ERP5HALJSONStyleSkinsMixin
):
def
test_getRequestUrl_REQUEST_disallowed
(
self
):
def
test_getRequestUrl_REQUEST_disallowed
(
self
):
self
.
changeSkin
(
'Hal'
)
self
.
assertRaises
(
self
.
assertRaises
(
Unauthorized
,
Unauthorized
,
self
.
portal
.
Base_getRequestUrl
,
self
.
portal
.
Base_getRequestUrl
,
...
@@ -116,6 +120,7 @@ class TestBase_getRequestUrl(ERP5HALJSONStyleSkinsMixin):
...
@@ -116,6 +120,7 @@ class TestBase_getRequestUrl(ERP5HALJSONStyleSkinsMixin):
class
TestBase_getRequestBody
(
ERP5HALJSONStyleSkinsMixin
):
class
TestBase_getRequestBody
(
ERP5HALJSONStyleSkinsMixin
):
def
test_getRequestBody_REQUEST_disallowed
(
self
):
def
test_getRequestBody_REQUEST_disallowed
(
self
):
self
.
changeSkin
(
'Hal'
)
self
.
assertRaises
(
self
.
assertRaises
(
Unauthorized
,
Unauthorized
,
self
.
portal
.
Base_getRequestBody
,
self
.
portal
.
Base_getRequestBody
,
...
@@ -127,6 +132,7 @@ class TestBase_getRequestBody(ERP5HALJSONStyleSkinsMixin):
...
@@ -127,6 +132,7 @@ class TestBase_getRequestBody(ERP5HALJSONStyleSkinsMixin):
class
TestBase_handleAcceptHeader
(
ERP5HALJSONStyleSkinsMixin
):
class
TestBase_handleAcceptHeader
(
ERP5HALJSONStyleSkinsMixin
):
def
test_handleAcceptHeader_REQUEST_disallowed
(
self
):
def
test_handleAcceptHeader_REQUEST_disallowed
(
self
):
self
.
changeSkin
(
'Hal'
)
self
.
assertRaises
(
self
.
assertRaises
(
Unauthorized
,
Unauthorized
,
self
.
portal
.
Base_handleAcceptHeader
,
self
.
portal
.
Base_handleAcceptHeader
,
...
@@ -136,6 +142,7 @@ class TestBase_handleAcceptHeader(ERP5HALJSONStyleSkinsMixin):
...
@@ -136,6 +142,7 @@ class TestBase_handleAcceptHeader(ERP5HALJSONStyleSkinsMixin):
@
simulate
(
'Base_getRequestHeader'
,
'*args, **kwargs'
,
'return "*/*"'
)
@
simulate
(
'Base_getRequestHeader'
,
'*args, **kwargs'
,
'return "*/*"'
)
@
changeSkin
(
'Hal'
)
@
changeSkin
(
'Hal'
)
def
test_handleAcceptHeader_star_accept
(
self
):
def
test_handleAcceptHeader_star_accept
(
self
):
self
.
changeSkin
(
'Hal'
)
self
.
assertEquals
(
self
.
assertEquals
(
self
.
portal
.
Base_handleAcceptHeader
([
'application/vnd+test'
,
self
.
portal
.
Base_handleAcceptHeader
([
'application/vnd+test'
,
'application/vnd+test2'
]),
'application/vnd+test2'
]),
...
@@ -146,6 +153,7 @@ class TestBase_handleAcceptHeader(ERP5HALJSONStyleSkinsMixin):
...
@@ -146,6 +153,7 @@ class TestBase_handleAcceptHeader(ERP5HALJSONStyleSkinsMixin):
'return "application/vnd+2test"'
)
'return "application/vnd+2test"'
)
@
changeSkin
(
'Hal'
)
@
changeSkin
(
'Hal'
)
def
test_handleAcceptHeader_matching_type
(
self
):
def
test_handleAcceptHeader_matching_type
(
self
):
self
.
changeSkin
(
'Hal'
)
self
.
assertEquals
(
self
.
assertEquals
(
self
.
portal
.
Base_handleAcceptHeader
([
'application/vnd+test'
,
self
.
portal
.
Base_handleAcceptHeader
([
'application/vnd+test'
,
'application/vnd+2test'
]),
'application/vnd+2test'
]),
...
@@ -156,6 +164,7 @@ class TestBase_handleAcceptHeader(ERP5HALJSONStyleSkinsMixin):
...
@@ -156,6 +164,7 @@ class TestBase_handleAcceptHeader(ERP5HALJSONStyleSkinsMixin):
'return "application/vnd+2test"'
)
'return "application/vnd+2test"'
)
@
changeSkin
(
'Hal'
)
@
changeSkin
(
'Hal'
)
def
test_handleAcceptHeader_non_matching_type
(
self
):
def
test_handleAcceptHeader_non_matching_type
(
self
):
self
.
changeSkin
(
'Hal'
)
self
.
assertEquals
(
self
.
assertEquals
(
self
.
portal
.
Base_handleAcceptHeader
([
'application/vnd+test'
]),
self
.
portal
.
Base_handleAcceptHeader
([
'application/vnd+test'
]),
None
None
...
@@ -1166,3 +1175,4 @@ class TestSlapOSSoftwareInstallation_getHateoasInformation(TestSlapOSHypermediaM
...
@@ -1166,3 +1175,4 @@ class TestSlapOSSoftwareInstallation_getHateoasInformation(TestSlapOSHypermediaM
},
},
},
},
},
indent
=
2
)))
},
indent
=
2
)))
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