Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.editor
Commits
2891474b
Commit
2891474b
authored
Jul 09, 2019
by
Christine MARCEL
Committed by
Samuel GAIST
Jul 31, 2019
Browse files
[test][assetwidget] Add missing test for deleting asset in edition
Only the yes condition was tested. Now both use cases are treated.
parent
07eb4877
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/editor/test/test_assetwidget.py
View file @
2891474b
...
...
@@ -301,7 +301,10 @@ class TestAssetWidget:
assert
target_name
in
asset_model
.
stringList
()
assert
os
.
path
.
exists
(
asset_model
.
json_path
(
target_name
))
def
test_delete
(
@
pytest
.
mark
.
parametrize
(
"messagebox_answer"
,
[
QMessageBox
.
Yes
,
QMessageBox
.
No
],
ids
=
[
"Yes"
,
"No"
]
)
def
test_delete_asset_in_edition
(
self
,
qtbot
,
monkeypatch
,
...
...
@@ -309,21 +312,28 @@ class TestAssetWidget:
beat_context
,
asset_type
,
asset_type_prefix_entry_map
,
messagebox_answer
,
):
asset_widget
=
AssetWidget
()
qtbot
.
addWidget
(
asset_widget
)
asset_widget
.
set_context
(
beat_context
)
asset_name
=
asset_type_prefix_entry_map
[
asset_type
][
0
]
monkeypatch
.
setattr
(
QMessageBox
,
"question"
,
lambda
*
args
:
QM
essage
B
ox
.
Yes
)
monkeypatch
.
setattr
(
QMessageBox
,
"question"
,
lambda
*
args
:
m
essage
b
ox
_answer
)
asset
=
Asset
(
test_prefix
,
asset_type
,
asset_name
)
with
qtbot
.
waitSignal
(
asset_widget
.
currentAssetChanged
):
asset_widget
.
loadAsset
(
asset
)
assert
asset_widget
.
current_editor
.
asset_type
!=
AssetType
.
UNKNOWN
asset_widget
.
deleteAsset
(
asset
.
declaration_path
)
assert
asset_widget
.
current_editor
.
asset_type
==
AssetType
.
UNKNOWN
assert
not
os
.
path
.
exists
(
asset
.
declaration_path
)
if
messagebox_answer
==
QMessageBox
.
Yes
:
assert
asset_widget
.
current_editor
.
asset_type
==
AssetType
.
UNKNOWN
assert
not
os
.
path
.
exists
(
asset
.
declaration_path
)
else
:
assert
asset_widget
.
current_editor
.
asset_type
!=
AssetType
.
UNKNOWN
assert
asset_widget
.
current_asset
==
asset
assert
os
.
path
.
exists
(
asset
.
declaration_path
)
def
test_load_empty_json
(
self
,
...
...
Write
Preview
Supports
Markdown
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