-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import pytest | ||
from counterpartycore.lib.api import apiv1 | ||
|
||
|
||
@pytest.fixture() | ||
def apiv1_app(ledger_db, state_db): | ||
Check warning Code scanning / pylint Unused argument 'ledger_db'. Warning
Unused argument 'ledger_db'.
Check warning Code scanning / pylint Unused argument 'state_db'. Warning
Unused argument 'state_db'.
|
||
app = apiv1.create_app() | ||
app.config.update( | ||
{ | ||
"TESTING": True, | ||
} | ||
) | ||
yield app | ||
|
||
|
||
def rpc_call(client, method, params): | ||
import json | ||
Check warning Code scanning / pylint Import outside toplevel (json). Warning
Import outside toplevel (json).
|
||
|
||
headers = {"content-type": "application/json"} | ||
payload = { | ||
"method": method, | ||
"params": params, | ||
"jsonrpc": "2.0", | ||
"id": 0, | ||
} | ||
return client.post("/", data=json.dumps(payload), headers=headers, auth=("rpc", "rpc")) | ||
|
||
|
||
@pytest.fixture() | ||
def apiv1_client(apiv1_app): | ||
Check warning Code scanning / pylint Redefining name 'apiv1_app' from outer scope (line 6). Warning
Redefining name 'apiv1_app' from outer scope (line 6).
|
||
def call(method, params): | ||
return rpc_call(apiv1_app.test_client(), method, params) | ||
|
||
return call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters