Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
internewshid
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
aptivate
client-projects
internewshid
Commits
86060dcf
Commit
86060dcf
authored
9 years ago
by
Mark Skipper
Browse files
Options
Downloads
Patches
Plain Diff
Make first transport roundtrip test pass
parent
9860287a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
django/website/transport/data_layer_transport.py
+3
-3
3 additions, 3 deletions
django/website/transport/data_layer_transport.py
django/website/transport/tests/message_tests.py
+11
-8
11 additions, 8 deletions
django/website/transport/tests/message_tests.py
with
14 additions
and
11 deletions
django/website/transport/data_layer_transport.py
+
3
−
3
View file @
86060dcf
from
data_layer.handlers
import
Message
def
get_messages
():
return
[]
return
Message
.
list
()
def
store_message
(
message
):
pass
Message
.
create
(
message
)
This diff is collapsed.
Click to expand it.
django/website/transport/tests/message_tests.py
+
11
−
8
View file @
86060dcf
from
__future__
import
unicode_literals
,
absolute_import
from
datetime
import
datetime
from
django.test.testcases
import
SimpleTestCase
from
django.test
import
TestCase
from
django.utils
import
timezone
from
transport
import
data_layer_transport
as
dl
class
TransportLayerMessageTests
(
SimpleTestCase
):
# TODO use mock here to verify the handler methods are being called instead of
# verifying the store behaviour
class
TransportLayerMessageTests
(
TestCase
):
def
test_get_messages_exists
(
self
):
messages
=
dl
.
get_messages
()
self
.
assertEqual
(
len
(
messages
),
0
)
self
.
assertEqual
(
len
(
list
(
messages
)
)
,
0
)
def
test_store_messages_exists
(
self
):
message
=
dict
()
dl
.
store_message
(
message
)
def
test_stored_messages_can_be_gotten
(
self
):
now
=
datetime
.
now
()
now
=
timezone
.
now
().
replace
(
microsecond
=
0
# MySQL discards microseconds
)
message
=
dict
(
body
=
"
Text
"
,
timestamp
=
now
)
dl
.
store_message
(
message
)
messages
=
dl
.
get_messages
()
messagelist
=
list
(
dl
.
get_messages
())
[
outmessage
]
=
messagelist
self
.
assertEqual
(
len
(
messages
),
1
)
outmessage
=
messages
[
1
]
self
.
assertEqual
(
outmessage
[
'
body
'
],
"
Text
"
)
self
.
assertEqual
(
outmessage
[
'
timestamp
'
],
now
)
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