betamaxpy / betamax

A VCR imitation designed only for python-requests.
https://betamax.readthedocs.io/en/latest/
Other
567 stars 62 forks source link

Add a use_cassette decorator #69

Closed sigmavirus24 closed 9 years ago

sigmavirus24 commented 9 years ago

Related to #61


TODO:

sigmavirus24 commented 9 years ago
import unittest

from betamax.decorator import use_cassette

@use_cassette('test-use-cassette-decorator', cassette_library_dir='.')
def test(session):
    session.get('https://httpbin.org/get')

class TestExample(unittest.TestCase):
    @use_cassette('test-unittest', cassette_library_dir='.')
    def test_stuff(self, session):
        session.get('https://httpbin.org/get')

if __name__ == '__main__':
    test()
    unittest.main()

Is what I've been using to test this.

sigmavirus24 commented 9 years ago

Now that the docs rewrite has been merged, I feel like we can definitely write good documentation around this and fit it into the new documentation appropriately.