From 8372872299a1ef9c03ffd3ad2b001317e6d50618 Mon Sep 17 00:00:00 2001 From: Matt Griswold Date: Mon, 1 Jan 2018 16:52:07 +0000 Subject: [PATCH] add context manager test --- tests/test_requests.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/test_requests.py b/tests/test_requests.py index 8f147ae..6c1bb41 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -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)