Skip to content

Commit

Permalink
Remove requests-mock library dependency from beacon tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kclowes committed Jan 13, 2021
1 parent 0096e96 commit af0c019
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
1 change: 1 addition & 0 deletions newsfragments/1827.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove ``request-mock`` dependency in beacon tests
28 changes: 1 addition & 27 deletions tests/beacon/test_beacon.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,19 @@
import json
import pytest

import requests

import requests_mock
from web3.beacon import (
Beacon,
)

GENESIS_RESPONSE = {
"data": {
"genesis_time": "1590832934",
"genesis_validators_root": (
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
),
"genesis_fork_version": "0x00000000",
}
}


@pytest.fixture
def session():
session = requests.Session()
adapter = requests_mock.Adapter()
session.mount("mock://", adapter)

adapter.register_uri(
"GET",
"mock://example.com/api/eth/v1/beacon/genesis",
text=json.dumps(GENESIS_RESPONSE),
)
return session


@pytest.fixture
def beacon(session):
# return Beacon(
# beacon_url="mock://example.com/api",
# session=session,
# )
return Beacon(base_url="http://localhost:5051", session=session)
return Beacon(base_url="http://localhost:5051", session=requests.Session())


# Beacon endpoint tests:
Expand Down

0 comments on commit af0c019

Please sign in to comment.