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
Eric Zheng
slapos.core
Commits
d3b44696
Commit
d3b44696
authored
May 02, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check that Access-Control-Allow-Headers are correctly supported.
parent
9f90a777
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
..._api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
+20
-1
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
+1
-1
No files found.
master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py
View file @
d3b44696
...
@@ -22,6 +22,17 @@ class Person_requestSoftwareInstanceRaisingSimulator(Person_requestSoftwareInsta
...
@@ -22,6 +22,17 @@ class Person_requestSoftwareInstanceRaisingSimulator(Person_requestSoftwareInsta
"""Simulation Method"""
"""Simulation Method"""
raise
self
.
exception
raise
self
.
exception
class
CustomHeaderHTTPConnection
(
httplib
.
HTTPConnection
):
def
__init__
(
self
,
custom_header
,
*
args
,
**
kwargs
):
self
.
_custom_header
=
custom_header
httplib
.
HTTPConnection
.
__init__
(
self
,
*
args
,
**
kwargs
)
def
request
(
self
,
*
args
,
**
kwargs
):
headers
=
kwargs
.
get
(
'headers'
,
{})
headers
.
update
(
self
.
_custom_header
)
kwargs
[
'headers'
]
=
headers
return
httplib
.
HTTPConnection
.
request
(
self
,
*
args
,
**
kwargs
)
class
TestVifibSlaposRestAPIV1
(
ERP5TypeTestCase
):
class
TestVifibSlaposRestAPIV1
(
ERP5TypeTestCase
):
def
generateNewId
(
self
):
def
generateNewId
(
self
):
return
str
(
self
.
getPortalObject
().
portal_ids
.
generateNewId
(
return
str
(
self
.
getPortalObject
().
portal_ids
.
generateNewId
(
...
@@ -42,6 +53,9 @@ class TestVifibSlaposRestAPIV1(ERP5TypeTestCase):
...
@@ -42,6 +53,9 @@ class TestVifibSlaposRestAPIV1(ERP5TypeTestCase):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
self
.
test_random_id
=
self
.
generateNewId
()
self
.
test_random_id
=
self
.
generateNewId
()
self
.
access_control_allow_headers
=
'some, funny, headers, '
\
'always, expected, %s'
%
self
.
test_random_id
self
.
document_list
=
[]
self
.
document_list
=
[]
self
.
portal
=
self
.
getPortalObject
()
self
.
portal
=
self
.
getPortalObject
()
self
.
customer
=
self
.
cloneByPath
(
'person_module/template_member'
)
self
.
customer
=
self
.
cloneByPath
(
'person_module/template_member'
)
...
@@ -57,7 +71,10 @@ class TestVifibSlaposRestAPIV1(ERP5TypeTestCase):
...
@@ -57,7 +71,10 @@ class TestVifibSlaposRestAPIV1(ERP5TypeTestCase):
self
.
api_scheme
,
self
.
api_netloc
,
self
.
api_path
,
self
.
api_query
,
\
self
.
api_scheme
,
self
.
api_netloc
,
self
.
api_path
,
self
.
api_query
,
\
self
.
api_fragment
=
urlparse
.
urlsplit
(
self
.
api_url
)
self
.
api_fragment
=
urlparse
.
urlsplit
(
self
.
api_url
)
self
.
connection
=
httplib
.
HTTPConnection
(
self
.
api_netloc
)
self
.
connection
=
CustomHeaderHTTPConnection
(
host
=
self
.
api_netloc
,
custom_header
=
{
'Access-Control-Allow-Headers'
:
self
.
access_control_allow_headers
})
self
.
reindexAndUpdateLocalRoles
()
self
.
reindexAndUpdateLocalRoles
()
self
.
simulator
=
tempfile
.
mkstemp
()[
1
]
self
.
simulator
=
tempfile
.
mkstemp
()[
1
]
self
.
customer
.
requestSoftwareInstance
=
Person_requestSoftwareInstanceSimulator
(
self
.
customer
.
requestSoftwareInstance
=
Person_requestSoftwareInstanceSimulator
(
...
@@ -83,6 +100,8 @@ class TestVifibSlaposRestAPIV1(ERP5TypeTestCase):
...
@@ -83,6 +100,8 @@ class TestVifibSlaposRestAPIV1(ERP5TypeTestCase):
'*'
)
'*'
)
self
.
assertEqual
(
self
.
response
.
getheader
(
'access-control-allow-methods'
),
self
.
assertEqual
(
self
.
response
.
getheader
(
'access-control-allow-methods'
),
'DELETE, PUT, POST, GET, OPTIONS'
)
'DELETE, PUT, POST, GET, OPTIONS'
)
self
.
assertEqual
(
self
.
response
.
getheader
(
'access-control-allow-headers'
),
self
.
access_control_allow_headers
)
def
assertResponseCode
(
self
,
code
):
def
assertResponseCode
(
self
,
code
):
self
.
assertEqual
(
self
.
response
.
status
,
code
,
self
.
assertEqual
(
self
.
response
.
status
,
code
,
...
...
master/bt5/vifib_slapos_rest_api_v1_test/bt/revision
View file @
d3b44696
6
7
\ No newline at end of file
\ No newline at end of file
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