Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DuniterPy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
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
clients
python
DuniterPy
Commits
cdf47ec4
Commit
cdf47ec4
authored
5 years ago
by
Vincent Texier
Browse files
Options
Downloads
Patches
Plain Diff
[fix]
#58
fix tests.api.ws2p.test_ws2p after rebase
parent
887842ba
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/api/ws2p/test_ws2p.py
+4
-19
4 additions, 19 deletions
tests/api/ws2p/test_ws2p.py
with
4 additions
and
19 deletions
tests/api/ws2p/test_ws2p.py
+
4
−
19
View file @
cdf47ec4
...
...
@@ -3,17 +3,16 @@ import unittest
import
jsonschema
from
duniterpy.api.client
import
Client
,
parse_text
from
duniterpy.api.endpoint
import
BMAEndpoint
from
duniterpy.api.ws2p.network
import
heads
,
WS2P_HEADS_SCHEMA
from
duniterpy.api.client
import
parse_text
from
duniterpy.api.ws2p.network
import
WS2P_HEADS_SCHEMA
from
duniterpy.api.ws2p.requests
import
BLOCK_RESPONSE_SCHEMA
,
ERROR_RESPONSE_SCHEMA
,
BLOCKS_RESPONSE_SCHEMA
,
\
REQUIREMENTS_RESPONSE_SCHEMA
from
duniterpy.documents
import
Identity
,
BlockUID
from
duniterpy.documents.ws2p.messages
import
DocumentMessage
from
tests.api.webserver
import
WebFunctionalSetupMixin
,
web
from
tests.api.webserver
import
WebFunctionalSetupMixin
class
TestWs2p
Heads
(
WebFunctionalSetupMixin
,
unittest
.
TestCase
):
class
TestWs2p
(
WebFunctionalSetupMixin
,
unittest
.
TestCase
):
def
test_block
(
self
):
json_sample
=
{
...
...
@@ -53,20 +52,6 @@ class TestWs2pHeads(WebFunctionalSetupMixin, unittest.TestCase):
jsonschema
.
validate
(
json_sample
,
WS2P_HEADS_SCHEMA
)
def
test_ws2p_heads_bad
(
self
):
async
def
handler
(
request
):
await
request
.
read
()
return
web
.
Response
(
body
=
b
'
{}
'
,
content_type
=
'
application/json
'
)
async
def
go
():
_
,
port
,
url
=
await
self
.
create_server
(
'
GET
'
,
'
/network/ws2p/heads
'
,
handler
)
with
self
.
assertRaises
(
jsonschema
.
ValidationError
):
client
=
Client
(
BMAEndpoint
(
"
127.0.0.1
"
,
""
,
""
,
port
))
await
client
(
heads
)
await
client
.
close
()
self
.
loop
.
run_until_complete
(
go
())
def
test_error_response_validation
(
self
):
error_response_string
=
"""
{
"
resId
"
:
"
cfe10cc4
"
,
"
err
"
:
"
Error message
"
}
"""
error_response
=
parse_text
(
error_response_string
,
ERROR_RESPONSE_SCHEMA
)
...
...
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