Skip to content

Commit

Permalink
add context manager test
Browse files Browse the repository at this point in the history
  • Loading branch information
grizz committed Jan 1, 2018
1 parent de1831b commit 8372872
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
import requests
import pytest


@pytest.RequestsData("req")
def test_requests(data_json):
def assert_test0(data):
res = requests.get('https://example.com/test0')
assert res.status_code == 200
assert data_json.expected == res.json()
assert data.expected == res.json()


@pytest.RequestsData("req")
def test_decorator(data_json):
assert_test0(data_json)


def test_context(data_json):
with pytest.RequestsData("req"):
assert_test0(data_json)

0 comments on commit 8372872

Please sign in to comment.