Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
force-bdss
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
Adham Hashibon
force-bdss
Commits
dbb8757a
Commit
dbb8757a
authored
7 years ago
by
Stefano Borini
Browse files
Options
Downloads
Patches
Plain Diff
Coverage
parent
be7ce5b5
No related branches found
No related tags found
1 merge request
!79
Deliver notification info
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
force_bdss/tests/test_core_mco_driver.py
+51
-1
51 additions, 1 deletion
force_bdss/tests/test_core_mco_driver.py
with
51 additions
and
1 deletion
force_bdss/tests/test_core_mco_driver.py
+
51
−
1
View file @
dbb8757a
import
unittest
import
unittest
from
testfixtures
import
LogCapture
from
force_bdss.mco.events
import
MCOStartEvent
from
force_bdss.mco.events
import
MCOStartEvent
from
force_bdss.tests
import
fixtures
from
force_bdss.tests
import
fixtures
...
@@ -31,6 +32,13 @@ class TestCoreMCODriver(unittest.TestCase):
...
@@ -31,6 +32,13 @@ class TestCoreMCODriver(unittest.TestCase):
)
)
driver
.
application_started
()
driver
.
application_started
()
def
test_stopping
(
self
):
driver
=
CoreMCODriver
(
application
=
self
.
mock_application
,
)
driver
.
application_started
()
driver
.
application_stopping
()
def
test_listeners
(
self
):
def
test_listeners
(
self
):
driver
=
CoreMCODriver
(
driver
=
CoreMCODriver
(
application
=
self
.
mock_application
,
application
=
self
.
mock_application
,
...
@@ -41,4 +49,46 @@ class TestCoreMCODriver(unittest.TestCase):
...
@@ -41,4 +49,46 @@ class TestCoreMCODriver(unittest.TestCase):
driver
=
CoreMCODriver
(
driver
=
CoreMCODriver
(
application
=
self
.
mock_application
,
application
=
self
.
mock_application
,
)
)
driver
.
mco
.
event
=
MCOStartEvent
()
listener
=
driver
.
listeners
[
0
]
mock_deliver
=
mock
.
Mock
()
listener
.
__dict__
[
"
deliver
"
]
=
mock_deliver
event
=
MCOStartEvent
()
driver
.
mco
.
event
=
event
self
.
assertTrue
(
mock_deliver
.
call_args
[
0
][
0
],
event
)
def
test_listener_initialization_exception
(
self
):
driver
=
CoreMCODriver
(
application
=
self
.
mock_application
,
)
listener
=
driver
.
listeners
[
0
]
mock_deliver
=
mock
.
Mock
()
listener
.
__dict__
[
"
deliver
"
]
=
mock_deliver
mock_deliver
.
side_effect
=
Exception
()
with
LogCapture
()
as
capture
:
driver
.
mco
.
event
=
MCOStartEvent
()
self
.
assertTrue
(
mock_deliver
.
called
)
capture
.
check
(
(
"
force_bdss.core_mco_driver
"
,
"
ERROR
"
,
"
Exception while delivering to listener
"
"
NullNotificationListener:
"
))
def
test_finalize_error
(
self
):
driver
=
CoreMCODriver
(
application
=
self
.
mock_application
,
)
driver
.
application_started
()
listener
=
driver
.
listeners
[
0
]
mock_finalize
=
mock
.
Mock
()
listener
.
__dict__
[
"
finalize
"
]
=
mock_finalize
mock_finalize
.
side_effect
=
Exception
()
with
LogCapture
()
as
capture
:
driver
.
application_stopping
()
capture
.
check
(
(
"
force_bdss.core_mco_driver
"
,
"
ERROR
"
,
"
Exception while finalizing listener
"
"
NullNotificationListener:
"
))
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