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
a49a923c
Commit
a49a923c
authored
6 years ago
by
Stefano Borini
Browse files
Options
Downloads
Patches
Plain Diff
Added tests
parent
929bbee6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!174
Added name, version and description to plugins
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
force_bdss/base_extension_plugin.py
+4
-0
4 additions, 0 deletions
force_bdss/base_extension_plugin.py
force_bdss/tests/test_base_extension_plugin.py
+18
-0
18 additions, 0 deletions
force_bdss/tests/test_base_extension_plugin.py
with
22 additions
and
0 deletions
force_bdss/base_extension_plugin.py
+
4
−
0
View file @
a49a923c
from
__future__
import
unicode_literals
import
logging
import
traceback
...
...
@@ -126,6 +127,9 @@ class BaseExtensionPlugin(Plugin):
self
.
_logger
.
exception
(
e
)
self
.
error_msg
=
str
(
e
)
self
.
error_tb
=
traceback
.
format_exc
()
self
.
name
=
""
self
.
description
=
""
self
.
version
=
0
self
.
broken
=
True
self
.
mco_factories
[:]
=
[]
self
.
data_source_factories
[:]
=
[]
...
...
This diff is collapsed.
Click to expand it.
force_bdss/tests/test_base_extension_plugin.py
+
18
−
0
View file @
a49a923c
import
unittest
try
:
import
mock
except
ImportError
:
import
unittest.mock
from
force_bdss.tests.probe_classes.probe_extension_plugin
import
\
ProbeExtensionPlugin
...
...
@@ -17,3 +21,17 @@ class TestBaseExtensionPlugin(unittest.TestCase):
self
.
assertEqual
(
plugin
.
name
,
u
"
Probe extension
"
)
self
.
assertEqual
(
plugin
.
version
,
0
)
self
.
assertEqual
(
plugin
.
description
,
u
"
A description
"
)
def
test_exception
(
self
):
with
mock
.
patch
.
object
(
ProbeExtensionPlugin
,
"
get_name
"
)
\
as
mock_get_name
:
mock_get_name
.
side_effect
=
Exception
(
"
Boom
"
)
plugin
=
ProbeExtensionPlugin
()
self
.
assertEqual
(
plugin
.
error_msg
,
"
Boom
"
)
self
.
assertNotEqual
(
plugin
.
error_tb
,
""
)
self
.
assertEqual
(
len
(
plugin
.
data_source_factories
),
0
)
self
.
assertEqual
(
len
(
plugin
.
notification_listener_factories
),
0
)
self
.
assertEqual
(
len
(
plugin
.
mco_factories
),
0
)
self
.
assertEqual
(
len
(
plugin
.
ui_hooks_factories
),
0
)
self
.
assertTrue
(
plugin
.
broken
)
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