Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Klaus Wölfel
erp5
Commits
8bf451d7
Commit
8bf451d7
authored
Sep 05, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test applying model.
parent
ee68acc4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
139 additions
and
1 deletion
+139
-1
bt5/erp5_computer_immobilisation/TestTemplateItem/testERP5ComputerWithComputerModel.py
...ion/TestTemplateItem/testERP5ComputerWithComputerModel.py
+137
-0
bt5/erp5_computer_immobilisation/bt/revision
bt5/erp5_computer_immobilisation/bt/revision
+1
-1
bt5/erp5_computer_immobilisation/bt/template_test_id_list
bt5/erp5_computer_immobilisation/bt/template_test_id_list
+1
-0
No files found.
bt5/erp5_computer_immobilisation/TestTemplateItem/testERP5ComputerWithComputerModel.py
0 → 100644
View file @
8bf451d7
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
class
TestERP5ComputerWithComputerModel
(
ERP5TypeTestCase
):
def
getBusinessTemplateList
(
self
):
return
[
'erp5_base'
,
'erp5_computer_immobilisation'
]
def
afterSetUp
(
self
):
pass
def
beforeTearDown
(
self
):
pass
def
newModel
(
self
,
**
kw
):
return
self
.
portal
.
computer_model_module
.
newContent
(
portal_type
=
'Computer Model'
,
**
kw
)
def
newComputer
(
self
,
**
kw
):
return
self
.
portal
.
computer_module
.
newContent
(
portal_type
=
'Computer'
,
**
kw
)
def
test_apply_model_empty_computer
(
self
):
category_list
=
[
'mana'
,
'mahna'
]
model
=
self
.
newModel
(
group
=
category_list
)
computer
=
self
.
newComputer
(
specialise_value
=
model
)
self
.
assertEqual
(
computer
.
getPropertyList
(
'group'
),
[])
result
=
computer
.
Computer_applyComputerModel
()
self
.
assertEqual
(
computer
.
getPropertyList
(
'group'
),
category_list
)
self
.
assertTrue
(
'=Computer%20Model%20applied.'
in
result
,
result
)
def
test_apply_model_empty_computer_batch_mode
(
self
):
category_list
=
[
'mana'
,
'mahna'
]
model
=
self
.
newModel
(
group
=
category_list
)
computer
=
self
.
newComputer
(
specialise_value
=
model
)
self
.
assertEqual
(
computer
.
getPropertyList
(
'group'
),
[])
result
=
computer
.
Computer_applyComputerModel
(
batch_mode
=
1
)
self
.
assertEqual
(
computer
.
getPropertyList
(
'group'
),
category_list
)
self
.
assertTrue
(
result
)
def
test_apply_model_filled_computer
(
self
):
computer_category_list
=
[
'oink'
]
category_list
=
[
'mana'
,
'mahna'
]
model
=
self
.
newModel
(
group
=
category_list
)
computer
=
self
.
newComputer
(
specialise_value
=
model
,
group
=
computer_category_list
)
self
.
assertEqual
(
computer
.
getPropertyList
(
'group'
),
computer_category_list
)
result
=
computer
.
Computer_applyComputerModel
()
self
.
assertEqual
(
computer
.
getPropertyList
(
'group'
),
computer_category_list
)
self
.
assertTrue
(
'=No%20changes%20applied.'
in
result
,
result
)
def
test_apply_model_filled_computer_batch_mode
(
self
):
computer_category_list
=
[
'oink'
]
category_list
=
[
'mana'
,
'mahna'
]
model
=
self
.
newModel
(
group
=
category_list
)
computer
=
self
.
newComputer
(
specialise_value
=
model
,
group
=
computer_category_list
)
self
.
assertEqual
(
computer
.
getPropertyList
(
'group'
),
computer_category_list
)
result
=
computer
.
Computer_applyComputerModel
()
self
.
assertEqual
(
computer
.
getPropertyList
(
'group'
),
computer_category_list
)
self
.
assertTrue
(
result
)
def
test_apply_model_filled_computer_forced
(
self
):
computer_category_list
=
[
'oink'
]
category_list
=
[
'mana'
,
'mahna'
]
model
=
self
.
newModel
(
group
=
category_list
)
computer
=
self
.
newComputer
(
specialise_value
=
model
,
group
=
computer_category_list
)
self
.
assertEqual
(
computer
.
getPropertyList
(
'group'
),
computer_category_list
)
result
=
computer
.
Computer_applyComputerModel
(
force
=
1
)
self
.
assertEqual
(
computer
.
getPropertyList
(
'group'
),
category_list
)
self
.
assertTrue
(
'=Computer%20Model%20applied.'
in
result
,
result
)
def
test_apply_model_filled_computer_force_batch_mode
(
self
):
computer_category_list
=
[
'oink'
]
category_list
=
[
'mana'
,
'mahna'
]
model
=
self
.
newModel
(
group
=
category_list
)
computer
=
self
.
newComputer
(
specialise_value
=
model
,
group
=
computer_category_list
)
self
.
assertEqual
(
computer
.
getPropertyList
(
'group'
),
computer_category_list
)
result
=
computer
.
Computer_applyComputerModel
(
force
=
1
,
batch_mode
=
1
)
self
.
assertEqual
(
computer
.
getPropertyList
(
'group'
),
category_list
)
self
.
assertTrue
(
result
)
def
test_apply_no_model
(
self
):
computer
=
self
.
newComputer
()
result
=
computer
.
Computer_applyComputerModel
()
self
.
assertTrue
(
'=No%20Computer%20Model.'
in
result
,
result
)
def
test_apply_no_model_batch_mode
(
self
):
computer
=
self
.
newComputer
()
result
=
computer
.
Computer_applyComputerModel
(
batch_mode
=
1
)
self
.
assertEqual
(
False
,
result
)
def
test_category_coverage
(
self
):
category_dict
=
{
'allocation_scope'
:
[
'allocation_scope1'
,
'allocation_scope2'
],
'cpu_core'
:
[
'cpu_core1'
,
'cpu_core2'
],
'cpu_frequency'
:
[
'cpu_frequency1'
,
'cpu_frequency2'
],
'cpu_type'
:
[
'cpu_type1'
,
'cpu_type2'
],
'function'
:
[
'function1'
,
'function2'
],
'group'
:
[
'group1'
,
'group2'
],
'local_area_network_type'
:
[
'local_area_network_type1'
,
'local_area_network_type2'
],
'memory_size'
:
[
'memory_size1'
,
'memory_size2'
],
'memory_type'
:
[
'memory_type1'
,
'memory_type2'
],
'product_line'
:
[
'product_line1'
,
'product_line2'
],
'role'
:
[
'role1'
,
'role2'
],
'storage_capacity'
:
[
'storage_capacity1'
,
'storage_capacity2'
],
'storage_interface'
:
[
'storage_interface1'
,
'storage_interface2'
],
'storage_redundancy'
:
[
'storage_redundancy1'
,
'storage_redundancy2'
],
}
model
=
self
.
newModel
(
**
category_dict
)
category_list
=
[]
for
k
,
v
in
category_dict
.
iteritems
():
for
l
in
v
:
category_list
.
append
(
'%s/%s'
%
(
k
,
l
))
category_list
.
append
(
'specialise/%s'
%
model
.
getRelativeUrl
())
computer
=
self
.
newComputer
(
specialise_value
=
model
)
result
=
computer
.
Computer_applyComputerModel
()
self
.
assertSameSet
(
category_list
,
computer
.
getCategoryList
())
self
.
assertTrue
(
'=Computer%20Model%20applied.'
,
result
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5ComputerWithComputerModel
))
return
suite
bt5/erp5_computer_immobilisation/bt/revision
View file @
8bf451d7
46
\ No newline at end of file
47
\ No newline at end of file
bt5/erp5_computer_immobilisation/bt/template_test_id_list
0 → 100644
View file @
8bf451d7
testERP5ComputerWithComputerModel
\ 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