chia-blockchain/tests/core/test_daemon_rpc.py
Adam Kelly 70639be906
Ak.convert fixtures (#10612)
* Use bt fixture

* rebase

* Use local_hostname

* flake8

* Remove set_shared_instance

* Remove unneeded comments

* Revert unrelated change

* Add back type signature - rebase issue

* Correct type for _configure_legacy_backend

* See what's going on during CI mypy run

* github workflows

* mypy typing

* Remove legacy Keyring create method

* Start daemon first

* Set chia-blockchain-gui to hash in main

* Fix two test files that were not importing self_hostname

* self_hostname fixture

* Convert all class fixtures to top level functions
2022-03-11 16:26:54 -08:00

26 lines
743 B
Python

import pytest
import pytest_asyncio
from tests.setup_nodes import setup_daemon
from chia.daemon.client import connect_to_daemon
from chia import __version__
@pytest_asyncio.fixture(scope="function")
async def get_daemon(bt):
async for _ in setup_daemon(btools=bt):
yield _
class TestDaemonRpc:
@pytest.mark.asyncio
async def test_get_version_rpc(self, get_daemon, bt):
ws_server = get_daemon
config = bt.config
client = await connect_to_daemon(config["self_hostname"], config["daemon_port"], bt.get_daemon_ssl_context())
response = await client.get_version()
assert response["data"]["success"]
assert response["data"]["version"] == __version__
ws_server.stop()