8000 Updated pubsubhubbub to use pytest fixture · kentr/github3.py@71096f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 71096f4

Browse files
Updated pubsubhubbub to use pytest fixture
Configures cassette to use betamax_simple_body as matcher.
1 parent e8cb47a commit 71096f4

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

tests/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import base64
22
import betamax
33
import os
4+
import pytest
45

56
from betamax_matchers import json_body
67

@@ -29,3 +30,11 @@
2930
'<BASIC_AUTH>',
3031
base64.b64encode(b':'.join(credentials)).decode()
3132
)
33+
34+
35+
@pytest.fixture
36+
def betamax_simple_body(request):
37+
"""Return configuration to match cassette on uri, method and body."""
38+
request.cls.betamax_simple_body = {
39+
'match_requests_on': ['uri', 'method', 'body']
40+
}

tests/integration/helper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
import betamax
33
import github3
44
import os
5+
import pytest
56
import unittest
67

78

9+
@pytest.mark.usefixtures('betamax_simple_body')
810
class IntegrationHelper(unittest.TestCase):
911
def setUp(self):
1012
self.user = os.environ.get('GH_USER', 'foo')

tests/integration/test_github.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,11 @@ def test_organization(self):
360360
assert isinstance(o, github3.orgs.Organization)
361361

362362
def test_pubsubhubbub(self):
363-
"""Test the ability to createa a pubsubhubbub hook."""
363+
"""Test the ability to create a pubsubhubbub hook."""
364364
self.token_login()
365-
betamax_kwargs = {
366-
'match_requests_on': ['uri', 'method', 'body']
367-
}
368365
cassette_name = self.cassette_name('pubsubhubbub')
369-
with self.recorder.use_cassette(cassette_name, **betamax_kwargs):
366+
with self.recorder.use_cassette(cassette_name,
367+
**self.betamax_simple_body):
370368
topic = 'https://github.com/itsmemattchung/github3.py/events/push'
371369
status = self.gh.pubsubhubbub(
372370
mode='subscribe',

0 commit comments

Comments
 (0)
0