Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
ots
hypha
Commits
8e251695
Commit
8e251695
authored
6 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Add basic test to send a message
parent
d1286e67
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
opentech/apply/activity/tests/__init__.py
+0
-0
0 additions, 0 deletions
opentech/apply/activity/tests/__init__.py
opentech/apply/activity/tests/test_messaging.py
+30
-0
30 additions, 0 deletions
opentech/apply/activity/tests/test_messaging.py
with
30 additions
and
0 deletions
opentech/apply/activity/tests/__init__.py
0 → 100644
+
0
−
0
View file @
8e251695
This diff is collapsed.
Click to expand it.
opentech/apply/activity/tests/test_messaging.py
0 → 100644
+
30
−
0
View file @
8e251695
from
unittest.mock
import
patch
from
django.test
import
TestCase
from
..messaging
import
AdapterBase
,
MESSAGES
class
TestAdapter
(
AdapterBase
):
"""
A test class which will pass the message type to send_message
"""
messages
=
{
enum
:
enum
.
value
for
enum
in
MESSAGES
.
__members__
.
values
()
}
def
send_message
(
self
,
message
,
**
kwargs
):
pass
class
TestBaseAdapter
(
TestCase
):
def
setUp
(
self
):
patched_class
=
patch
.
object
(
TestAdapter
,
'
send_message
'
)
self
.
mock_adapter
=
patched_class
.
start
()
self
.
adapter
=
TestAdapter
()
self
.
addCleanup
(
patched_class
.
stop
)
def
test_can_send_a_message
(
self
):
message_type
=
MESSAGES
.
UPDATE_LEAD
self
.
adapter
.
process
(
message_type
)
self
.
adapter
.
send_message
.
assert_called_once_with
(
message_type
.
value
)
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