Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
b1f7cc8f
Commit
b1f7cc8f
authored
8 years ago
by
Florian Thöni
Browse files
Options
Downloads
Patches
Plain Diff
Genericate function for click button in test helper + usage in test_certification_dialog
parent
ddb0f283
No related branches found
No related tags found
1 merge request
!684
READY:Test helpers : Message box, click yes vs enter
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/functional/test_certification_dialog.py
+3
-3
3 additions, 3 deletions
tests/functional/test_certification_dialog.py
tests/helpers.py
+7
-0
7 additions, 0 deletions
tests/helpers.py
with
10 additions
and
3 deletions
tests/functional/test_certification_dialog.py
+
3
−
3
View file @
b1f7cc8f
...
@@ -3,9 +3,9 @@ import pytest
...
@@ -3,9 +3,9 @@ import pytest
from
duniterpy.documents
import
Certification
from
duniterpy.documents
import
Certification
from
PyQt5.QtCore
import
QLocale
,
Qt
,
QEvent
from
PyQt5.QtCore
import
QLocale
,
Qt
,
QEvent
from
PyQt5.QtTest
import
QTest
from
PyQt5.QtTest
import
QTest
from
PyQt5.QtWidgets
import
QDialogButtonBox
from
PyQt5.QtWidgets
import
QDialogButtonBox
,
QMessageBox
from
sakia.gui.sub.certification.controller
import
CertificationController
from
sakia.gui.sub.certification.controller
import
CertificationController
from
..helpers
import
yes
_on_top_message_box
from
..helpers
import
click
_on_top_message_box
_button
@pytest.mark.asyncio
@pytest.mark.asyncio
...
@@ -43,7 +43,7 @@ async def test_certification_init_community(application_with_one_connection, fak
...
@@ -43,7 +43,7 @@ async def test_certification_init_community(application_with_one_connection, fak
assert
certification_dialog
.
view
.
button_box
.
button
(
QDialogButtonBox
.
Ok
).
isEnabled
()
assert
certification_dialog
.
view
.
button_box
.
button
(
QDialogButtonBox
.
Ok
).
isEnabled
()
QTest
.
mouseClick
(
certification_dialog
.
view
.
button_box
.
button
(
QDialogButtonBox
.
Ok
),
Qt
.
LeftButton
)
QTest
.
mouseClick
(
certification_dialog
.
view
.
button_box
.
button
(
QDialogButtonBox
.
Ok
),
Qt
.
LeftButton
)
await
asyncio
.
sleep
(
0.1
)
await
asyncio
.
sleep
(
0.1
)
yes
_on_top_message_box
(
)
click
_on_top_message_box
_button
(
QMessageBox
.
Yes
)
await
asyncio
.
sleep
(
0.2
)
await
asyncio
.
sleep
(
0.2
)
assert
isinstance
(
fake_server_with_blockchain
.
forge
.
pool
[
0
],
Certification
)
assert
isinstance
(
fake_server_with_blockchain
.
forge
.
pool
[
0
],
Certification
)
...
...
This diff is collapsed.
Click to expand it.
tests/helpers.py
+
7
−
0
View file @
b1f7cc8f
...
@@ -3,6 +3,13 @@ from PyQt5.QtCore import Qt
...
@@ -3,6 +3,13 @@ from PyQt5.QtCore import Qt
from
PyQt5.QtTest
import
QTest
from
PyQt5.QtTest
import
QTest
def
click_on_top_message_box_button
(
button
):
topWidgets
=
QApplication
.
topLevelWidgets
()
for
w
in
topWidgets
:
if
isinstance
(
w
,
QMessageBox
):
QTest
.
mouseClick
(
w
.
button
(
button
),
Qt
.
LeftButton
)
def
click_on_top_message_box
():
def
click_on_top_message_box
():
topWidgets
=
QApplication
.
topLevelWidgets
()
topWidgets
=
QApplication
.
topLevelWidgets
()
for
w
in
topWidgets
:
for
w
in
topWidgets
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment