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
Boxiang Sun
slapos.core
Commits
ae610908
Commit
ae610908
authored
Aug 02, 2017
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_slap_tool: testSlapOSSlapTool use person.getUserId instead person.getReference
parent
11bdc499
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
33 deletions
+61
-33
master/bt5/slapos_slap_tool/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSSlapTool.xml
...eItem/portal_components/extension.erp5.SlapOSSlapTool.xml
+30
-3
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.py
...ateItem/portal_components/test.erp5.testSlapOSSlapTool.py
+22
-21
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.xml
...teItem/portal_components/test.erp5.testSlapOSSlapTool.xml
+9
-9
No files found.
master/bt5/slapos_slap_tool/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSSlapTool.xml
View file @
ae610908
...
...
@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
SlapOSSlapTool
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
extension.erp5.SlapOSSlapTool
</string>
</value>
...
...
@@ -43,13 +55,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -62,7 +89,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -71,7 +98,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
...
...
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.py
View file @
ae610908
...
...
@@ -2141,10 +2141,11 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
person
.
recursiveImmediateReindexObject
()
self
.
person
=
person
self
.
person_reference
=
person
.
getReference
()
self
.
person_user_id
=
person
.
getUserId
()
TestSlapOSSlapToolMixin
.
afterSetUp
(
self
,
person
=
person
)
def
test_not_accessed_getComputerStatus
(
self
):
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
created_at
=
rfc1123_date
(
DateTime
())
response
=
self
.
portal_slap
.
getComputerStatus
(
self
.
computer_id
)
self
.
assertEqual
(
200
,
response
.
status
)
...
...
@@ -2185,7 +2186,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def
test_accessed_getComputerStatus
(
self
):
self
.
login
(
self
.
computer_id
)
self
.
portal_slap
.
getFullComputerInformation
(
self
.
computer_id
)
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
created_at
=
rfc1123_date
(
DateTime
())
response
=
self
.
portal_slap
.
getComputerStatus
(
self
.
computer_id
)
self
.
assertEqual
(
200
,
response
.
status
)
...
...
@@ -2233,7 +2234,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'recmethod'
:
'reportComputerBang'
}])
def
test_computerBang
(
self
):
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
self
.
computer_bang_simulator
=
tempfile
.
mkstemp
()[
1
]
try
:
self
.
computer
.
reportComputerBang
=
Simulator
(
...
...
@@ -2276,7 +2277,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def
test_getComputerPartitionStatus
(
self
):
self
.
_makeComplexComputer
()
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
partition_id
=
self
.
start_requested_software_instance
.
getAggregateValue
(
portal_type
=
'Computer Partition'
).
getReference
()
created_at
=
rfc1123_date
(
DateTime
())
...
...
@@ -2319,13 +2320,13 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def
test_getComputerPartitionStatus_visited
(
self
):
self
.
_makeComplexComputer
(
person
=
self
.
person
)
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
partition_id
=
self
.
start_requested_software_instance
.
getAggregateValue
(
portal_type
=
'Computer Partition'
).
getReference
()
created_at
=
rfc1123_date
(
DateTime
())
self
.
login
(
self
.
start_requested_software_instance
.
getReference
())
self
.
portal_slap
.
registerComputerPartition
(
self
.
computer_id
,
partition_id
)
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
response
=
self
.
portal_slap
.
getComputerPartitionStatus
(
self
.
computer_id
,
partition_id
)
self
.
assertEqual
(
200
,
response
.
status
)
...
...
@@ -2368,7 +2369,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
self
.
_makeComplexComputer
(
person
=
self
.
person
,
with_slave
=
True
)
partition_id
=
self
.
start_requested_software_instance
.
getAggregateValue
(
portal_type
=
'Computer Partition'
).
getReference
()
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
response
=
self
.
portal_slap
.
registerComputerPartition
(
self
.
computer_id
,
partition_id
)
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assertEqual
(
'public, max-age=1, stale-if-error=604800'
,
...
...
@@ -2500,7 +2501,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
self
.
_makeComplexComputer
(
person
=
self
.
person
)
partition_id
=
self
.
start_requested_software_instance
.
getAggregateValue
(
portal_type
=
'Computer Partition'
).
getReference
()
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
response
=
self
.
portal_slap
.
registerComputerPartition
(
self
.
computer_id
,
partition_id
)
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assertEqual
(
'public, max-age=1, stale-if-error=604800'
,
...
...
@@ -2623,7 +2624,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
try
:
partition_id
=
self
.
start_requested_software_instance
.
getAggregateValue
(
portal_type
=
'Computer Partition'
).
getReference
()
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
self
.
start_requested_software_instance
.
bang
=
Simulator
(
self
.
instance_bang_simulator
,
'bang'
)
error_log
=
'Please bang me'
...
...
@@ -2662,7 +2663,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
finally
:
if
os
.
path
.
exists
(
self
.
instance_bang_simulator
):
os
.
unlink
(
self
.
instance_bang_simulator
)
def
assertInstanceRenameSimulator
(
self
,
args
,
kwargs
):
stored
=
eval
(
open
(
self
.
instance_rename_simulator
).
read
())
# do the same translation magic as in workflow
...
...
@@ -2676,7 +2677,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
try
:
partition_id
=
self
.
start_requested_software_instance
.
getAggregateValue
(
portal_type
=
'Computer Partition'
).
getReference
()
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
self
.
start_requested_software_instance
.
rename
=
Simulator
(
self
.
instance_rename_simulator
,
'rename'
)
new_name
=
'new me'
...
...
@@ -2700,7 +2701,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def
test_request_withSlave
(
self
):
self
.
instance_request_simulator
=
tempfile
.
mkstemp
()[
1
]
try
:
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
self
.
person
.
requestSoftwareInstance
=
Simulator
(
self
.
instance_request_simulator
,
'requestSoftwareInstance'
)
response
=
self
.
portal_slap
.
requestComputerPartition
(
...
...
@@ -2730,7 +2731,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def
test_request
(
self
):
self
.
instance_request_simulator
=
tempfile
.
mkstemp
()[
1
]
try
:
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
self
.
person
.
requestSoftwareInstance
=
Simulator
(
self
.
instance_request_simulator
,
'requestSoftwareInstance'
)
response
=
self
.
portal_slap
.
requestComputerPartition
(
...
...
@@ -2766,7 +2767,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
self
.
_makeComplexComputer
(
person
=
self
.
person
)
self
.
start_requested_software_instance
.
updateLocalRolesOnSecurityGroups
()
self
.
tic
()
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
response
=
self
.
portal_slap
.
requestComputerPartition
(
software_release
=
self
.
start_requested_software_instance
.
getUrlString
(),
software_type
=
self
.
start_requested_software_instance
.
getSourceReference
(),
...
...
@@ -2857,7 +2858,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def
test_computerSupply
(
self
):
self
.
computer_supply_simulator
=
tempfile
.
mkstemp
()[
1
]
try
:
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
self
.
computer
.
requestSoftwareRelease
=
Simulator
(
self
.
computer_supply_simulator
,
'requestSoftwareRelease'
)
software_url
=
'live_test_url_%s'
%
self
.
generateNewId
()
...
...
@@ -2884,7 +2885,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def
test_requestComputer
(
self
):
self
.
computer_request_computer_simulator
=
tempfile
.
mkstemp
()[
1
]
try
:
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
self
.
person
.
requestComputer
=
Simulator
(
self
.
computer_request_computer_simulator
,
'requestComputer'
)
...
...
@@ -2932,7 +2933,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def
test_generateComputerCertificate
(
self
):
self
.
generate_computer_certificate_simulator
=
tempfile
.
mkstemp
()[
1
]
try
:
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
self
.
computer
.
generateCertificate
=
Simulator
(
self
.
generate_computer_certificate_simulator
,
'generateComputerCertificate'
)
...
...
@@ -2979,9 +2980,9 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def
test_revokeComputerCertificate
(
self
):
self
.
revoke_computer_certificate_simulator
=
tempfile
.
mkstemp
()[
1
]
try
:
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
self
.
computer
.
revokeCertificate
=
Simulator
(
self
.
revoke_computer_certificate_simulator
,
self
.
revoke_computer_certificate_simulator
,
'revokeComputerCertificate'
)
response
=
self
.
portal_slap
.
revokeComputerCertificate
(
self
.
computer_id
)
...
...
@@ -2998,7 +2999,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
if
preference
.
getPreferenceState
()
==
'global'
:
preference
.
setPreferredHateoasUrl
(
''
)
self
.
tic
()
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
self
.
assertRaises
(
NotFound
,
self
.
portal_slap
.
getHateoasUrl
)
def
test_getHateoasUrl
(
self
):
...
...
@@ -3008,7 +3009,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
if
preference
.
getPreferenceState
()
==
'global'
:
preference
.
setPreferredHateoasUrl
(
'foo'
)
self
.
tic
()
self
.
login
(
self
.
person_
reference
)
self
.
login
(
self
.
person_
user_id
)
response
=
self
.
portal_slap
.
getHateoasUrl
()
self
.
assertEqual
(
200
,
response
.
status
)
self
.
assertEqual
(
'foo'
,
response
.
body
)
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.xml
View file @
ae610908
...
...
@@ -55,15 +55,15 @@
<string>
W:1514, 13: Use of eval (eval-used)
</string>
<string>
W:1568, 13: Use of eval (eval-used)
</string>
<string>
W:1608, 13: Use of eval (eval-used)
</string>
<string>
W:2
015
, 2: Arguments number differs from overridden \'afterSetUp\' method (arguments-differ)
</string>
<string>
W:2
111
, 13: Use of eval (eval-used)
</string>
<string>
W:2
496
, 13: Use of eval (eval-used)
</string>
<string>
W:2
550
, 13: Use of eval (eval-used)
</string>
<string>
W:2
577
, 13: Use of eval (eval-used)
</string>
<string>
W:2
732
, 13: Use of eval (eval-used)
</string>
<string>
W:2
760
, 13: Use of eval (eval-used)
</string>
<string>
W:2
809
, 13: Use of eval (eval-used)
</string>
<string>
W:2
856
, 13: Use of eval (eval-used)
</string>
<string>
W:2
132
, 2: Arguments number differs from overridden \'afterSetUp\' method (arguments-differ)
</string>
<string>
W:2
229
, 13: Use of eval (eval-used)
</string>
<string>
W:2
614
, 13: Use of eval (eval-used)
</string>
<string>
W:2
668
, 13: Use of eval (eval-used)
</string>
<string>
W:2
695
, 13: Use of eval (eval-used)
</string>
<string>
W:2
850
, 13: Use of eval (eval-used)
</string>
<string>
W:2
878
, 13: Use of eval (eval-used)
</string>
<string>
W:2
927
, 13: Use of eval (eval-used)
</string>
<string>
W:2
974
, 13: Use of eval (eval-used)
</string>
</tuple>
</value>
</item>
...
...
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