Hello community,

here is the log from the commit of package python-betamax for openSUSE:Factory 
checked in at 2016-12-08 00:29:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-betamax (Old)
 and      /work/SRC/openSUSE:Factory/.python-betamax.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-betamax"

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-betamax/python-betamax.changes    
2016-06-09 16:16:49.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.python-betamax.new/python-betamax.changes       
2016-12-08 00:29:24.000000000 +0100
@@ -1,0 +2,21 @@
+Tue Nov 15 10:34:38 UTC 2016 - [email protected]
+
+- update to 0.8.0:
+  - Add ``betamax_parametrized_recorder`` and ``betamax_parametrized_session``
+    to our list of pytest fixtures so that users will have parametrized 
cassette
+    names when writing parametrized tests with our fixtures. (I wonder if I can
+    mention parametrization a bunch more times so I can say parametrize a lot 
in
+    this bullet note.)
+  - Add ``ValidationError`` and a set of subclasses for each possible 
validation
+    error.
+  - Raise ``InvalidOption`` on unknown cassette options rather than silently
+    ignoring extra options.
+  - Raise a subclass of ``ValidationError`` when a particular cassette option 
is
+    invalid, rather than silently ignoring the validation failure.
+  - Fix bug with query string matcher where query-strings without values (e.g.,
+    ``?foo&bar`` as opposed to ``?foo=1&bar=2``) were treated as if there were
+    no query string.
+  - Fix issue #108 by effectively copying the items in the match_requests_on
+    list into the match_options set on a Cassette instance
+
+-------------------------------------------------------------------

Old:
----
  betamax-0.7.0.tar.gz

New:
----
  betamax-0.8.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-betamax.spec ++++++
--- /var/tmp/diff_new_pack.4fpQIn/_old  2016-12-08 00:29:25.000000000 +0100
+++ /var/tmp/diff_new_pack.4fpQIn/_new  2016-12-08 00:29:25.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           python-betamax
-Version:        0.7.0
+Version:        0.8.0
 Release:        0
 Summary:        A VCR imitation for python-requests
 License:        Apache-2.0

++++++ betamax-0.7.0.tar.gz -> betamax-0.8.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/HISTORY.rst 
new/betamax-0.8.0/HISTORY.rst
--- old/betamax-0.7.0/HISTORY.rst       2016-04-29 18:18:50.000000000 +0200
+++ new/betamax-0.8.0/HISTORY.rst       2016-08-16 23:59:48.000000000 +0200
@@ -1,6 +1,34 @@
 History
 =======
 
+0.8.0 - 2016-08-16
+------------------
+
+- Add ``betamax_parametrized_recorder`` and ``betamax_parametrized_session``
+  to our list of pytest fixtures so that users will have parametrized cassette
+  names when writing parametrized tests with our fixtures. (I wonder if I can
+  mention parametrization a bunch more times so I can say parametrize a lot in
+  this bullet note.)
+- Add ``ValidationError`` and a set of subclasses for each possible validation
+  error.
+- Raise ``InvalidOption`` on unknown cassette options rather than silently
+  ignoring extra options.
+- Raise a subclass of ``ValidationError`` when a particular cassette option is
+  invalid, rather than silently ignoring the validation failure.
+
+0.7.2 - 2016-08-04
+------------------
+
+- Fix bug with query string matcher where query-strings without values (e.g.,
+  ``?foo&bar`` as opposed to ``?foo=1&bar=2``) were treated as if there were
+  no query string.
+
+0.7.1 - 2016-06-14
+------------------
+
+- Fix issue #108 by effectively copying the items in the match_requests_on
+  list into the match_options set on a Cassette instance
+
 0.7.0 - 2016-04-29
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/PKG-INFO new/betamax-0.8.0/PKG-INFO
--- old/betamax-0.7.0/PKG-INFO  2016-04-29 18:19:50.000000000 +0200
+++ new/betamax-0.8.0/PKG-INFO  2016-08-17 00:00:42.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: betamax
-Version: 0.7.0
+Version: 0.8.0
 Summary: A VCR imitation for python-requests
 Home-page: https://github.com/sigmavirus24/betamax
 Author: Ian Cordasco
@@ -98,6 +98,34 @@
         History
         =======
         
+        0.8.0 - 2016-08-16
+        ------------------
+        
+        - Add ``betamax_parametrized_recorder`` and 
``betamax_parametrized_session``
+          to our list of pytest fixtures so that users will have parametrized 
cassette
+          names when writing parametrized tests with our fixtures. (I wonder 
if I can
+          mention parametrization a bunch more times so I can say parametrize 
a lot in
+          this bullet note.)
+        - Add ``ValidationError`` and a set of subclasses for each possible 
validation
+          error.
+        - Raise ``InvalidOption`` on unknown cassette options rather than 
silently
+          ignoring extra options.
+        - Raise a subclass of ``ValidationError`` when a particular cassette 
option is
+          invalid, rather than silently ignoring the validation failure.
+        
+        0.7.2 - 2016-08-04
+        ------------------
+        
+        - Fix bug with query string matcher where query-strings without values 
(e.g.,
+          ``?foo&bar`` as opposed to ``?foo=1&bar=2``) were treated as if 
there were
+          no query string.
+        
+        0.7.1 - 2016-06-14
+        ------------------
+        
+        - Fix issue #108 by effectively copying the items in the 
match_requests_on
+          list into the match_options set on a Cassette instance
+        
         0.7.0 - 2016-04-29
         ------------------
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/betamax/__init__.py 
new/betamax-0.8.0/betamax/__init__.py
--- old/betamax-0.7.0/betamax/__init__.py       2016-04-29 18:03:53.000000000 
+0200
+++ new/betamax-0.8.0/betamax/__init__.py       2016-08-16 23:57:58.000000000 
+0200
@@ -22,5 +22,5 @@
 __copyright__ = 'Copyright 2013-2014 Ian Cordasco'
 __license__ = 'Apache 2.0'
 __title__ = 'betamax'
-__version__ = '0.7.0'
+__version__ = '0.8.0'
 __version_info__ = tuple(int(i) for i in __version__.split('.'))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/betamax/adapter.py 
new/betamax-0.8.0/betamax/adapter.py
--- old/betamax-0.7.0/betamax/adapter.py        2016-04-29 17:06:30.000000000 
+0200
+++ new/betamax-0.8.0/betamax/adapter.py        2016-06-14 23:17:19.000000000 
+0200
@@ -94,7 +94,9 @@
         if 'record' in self.options:
             self.cassette.record_mode = self.options['record']
 
-        self.cassette.match_options = match_requests_on
+        # NOTE(sigmavirus24): Cassette.match_options is a set, might as well
+        # use that instead of overriding it.
+        self.cassette.match_options.update(match_requests_on)
 
         re_record_interval = timedelta.max
         if self.options.get('re_record_interval'):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/betamax/exceptions.py 
new/betamax-0.8.0/betamax/exceptions.py
--- old/betamax-0.7.0/betamax/exceptions.py     2015-12-22 23:10:56.000000000 
+0100
+++ new/betamax-0.8.0/betamax/exceptions.py     2016-08-12 13:25:58.000000000 
+0200
@@ -8,3 +8,51 @@
 
 class MissingDirectoryError(BetamaxError):
     pass
+
+
+class ValidationError(BetamaxError):
+    pass
+
+
+class InvalidOption(ValidationError):
+    pass
+
+
+class BodyBytesValidationError(ValidationError):
+    pass
+
+
+class MatchersValidationError(ValidationError):
+    pass
+
+
+class RecordValidationError(ValidationError):
+    pass
+
+
+class RecordIntervalValidationError(ValidationError):
+    pass
+
+
+class PlaceholdersValidationError(ValidationError):
+    pass
+
+
+class PlaybackRepeatsValidationError(ValidationError):
+    pass
+
+
+class SerializerValidationError(ValidationError):
+    pass
+
+
+validation_error_map = {
+    'allow_playback_repeats': PlaybackRepeatsValidationError,
+    'match_requests_on': MatchersValidationError,
+    'record': RecordValidationError,
+    'placeholders': PlaceholdersValidationError,
+    'preserve_exact_body_bytes': BodyBytesValidationError,
+    're_record_interval': RecordIntervalValidationError,
+    'serialize': SerializerValidationError,  # TODO: Remove this
+    'serialize_with': SerializerValidationError
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/betamax/fixtures/pytest.py 
new/betamax-0.8.0/betamax/fixtures/pytest.py
--- old/betamax-0.7.0/betamax/fixtures/pytest.py        2016-02-06 
17:30:09.000000000 +0100
+++ new/betamax-0.8.0/betamax/fixtures/pytest.py        2016-08-16 
23:51:53.000000000 +0200
@@ -7,28 +7,30 @@
 
 from __future__ import absolute_import
 
+import re
+import warnings
+
 import pytest
 import requests
 
 from .. import recorder as betamax
 
 
[email protected]
-def betamax_recorder(request):
-    """Generate a recorder with a session that has Betamax already installed.
+def _sanitize(name):
+    """Replace whitespace and / with -"""
+    return re.sub('[\s/]+', '-', name)
 
-    This will create a new Betamax instance with a generated cassette name.
-    The cassette name is generated by first using the module name from where
-    the test is collected, then the class name (if it exists), and then the
-    test function name. For example, if your test is in ``test_stuff.py`` and
-    is the method ``TestStuffClass.test_stuff`` then your cassette name will be
-    ``test_stuff_TestStuffClass_test_stuff``.
+
+def _casette_name(request, parametrized):
+    """Determine a cassette name from request.
 
     :param request:
         A request object from pytest giving us context information for the
         fixture.
+    :param parametrized:
+        Whether the name should consider parametrized tests.
     :returns:
-        An instantiated recorder.
+        A cassette name.
     """
     cassette_name = ''
 
@@ -38,8 +40,24 @@
     if request.cls is not None:
         cassette_name += request.cls.__name__ + '.'
 
-    cassette_name += request.function.__name__
+    if parametrized:
+        cassette_name += _sanitize(request.node.name)
+    else:
+        cassette_name += request.function.__name__
+        if request.node.name != request.function.__name__:
+            warnings.warn(
+                "betamax_recorder and betamax_session currently don't include "
+                "parameters in the cassette name. "
+                "Use betamax_parametrized_recorder/_session to include "
+                "parameters. "
+                "This behavior will be the default in betamax 1.0",
+                FutureWarning, stacklevel=3)
+
+    return cassette_name
 
+
+def _betamax_recorder(request, parametrized=True):
+    cassette_name = _casette_name(request, parametrized=parametrized)
     session = requests.Session()
     recorder = betamax.Betamax(session)
     recorder.use_cassette(cassette_name)
@@ -49,6 +67,29 @@
 
 
 @pytest.fixture
+def betamax_recorder(request):
+    """Generate a recorder with a session that has Betamax already installed.
+
+    This will create a new Betamax instance with a generated cassette name.
+    The cassette name is generated by first using the module name from where
+    the test is collected, then the class name (if it exists), and then the
+    test function name. For example, if your test is in ``test_stuff.py`` and
+    is the method ``TestStuffClass.test_stuff`` then your cassette name will be
+    ``test_stuff_TestStuffClass_test_stuff``. If the test is parametrized,
+    the parameters will not be included in the name. In case you need that,
+    use betamax_parametrized_recorder instead. This will change in 1.0.0,
+    where parameters will be included by default.
+
+    :param request:
+        A request object from pytest giving us context information for the
+        fixture.
+    :returns:
+        An instantiated recorder.
+    """
+    return _betamax_recorder(request, parametrized=False)
+
+
[email protected]
 def betamax_session(betamax_recorder):
     """Generate a session that has Betamax already installed.
 
@@ -61,3 +102,45 @@
     """
 
     return betamax_recorder.session
+
+
[email protected]
+def betamax_parametrized_recorder(request):
+    """Generate a recorder with a session that has Betamax already installed.
+
+    This will create a new Betamax instance with a generated cassette name.
+    The cassette name is generated by first using the module name from where
+    the test is collected, then the class name (if it exists), and then the
+    test function name with parameters if parametrized.
+    For example, if your test is in ``test_stuff.py`` and
+    the method is ``TestStuffClass.test_stuff`` with parameter ``True`` then
+    your cassette name will be
+    ``test_stuff_TestStuffClass_test_stuff[True]``.
+
+    :param request:
+        A request object from pytest giving us context information for the
+        fixture.
+    :returns:
+        An instantiated recorder.
+    """
+    warnings.warn(
+        "betamax_parametrized_recorder and betamax_parametrized_session "
+        "will be removed in betamax 1.0. Their behavior will be the "
+        "default.",
+        DeprecationWarning)
+    return _betamax_recorder(request, parametrized=True)
+
+
[email protected]
+def betamax_parametrized_session(betamax_parametrized_recorder):
+    """Generate a session that has Betamax already installed.
+
+    See `betamax_parametrized_recorder` fixture.
+
+    :param betamax_parametrized_recorder:
+        A recorder fixture with a configured request session.
+    :returns:
+        An instantiated requests Session wrapped by Betamax.
+    """
+
+    return betamax_parametrized_recorder.session
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/betamax/matchers/body.py 
new/betamax-0.8.0/betamax/matchers/body.py
--- old/betamax-0.7.0/betamax/matchers/body.py  2016-01-18 00:59:32.000000000 
+0100
+++ new/betamax-0.8.0/betamax/matchers/body.py  2016-08-11 22:39:18.000000000 
+0200
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 from .base import BaseMatcher
-from betamax.util import deserialize_prepared_request
+
+from betamax import util
 
 
 class BodyMatcher(BaseMatcher):
@@ -8,14 +9,14 @@
     name = 'body'
 
     def match(self, request, recorded_request):
-        recorded_request = deserialize_prepared_request(recorded_request)
+        recorded_request = util.deserialize_prepared_request(recorded_request)
 
+        request_body = b''
         if request.body:
-            if isinstance(recorded_request.body, type(request.body)):
-                request_body = request.body
-            else:
-                request_body = request.body.encode('utf-8')
-        else:
-            request_body = b''
+            request_body = util.coerce_content(request.body)
+
+        recorded_body = b''
+        if recorded_request.body:
+            recorded_body = util.coerce_content(recorded_request.body)
 
-        return recorded_request.body == request_body
+        return recorded_body == request_body
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/betamax/matchers/query.py 
new/betamax-0.8.0/betamax/matchers/query.py
--- old/betamax-0.7.0/betamax/matchers/query.py 2016-04-26 16:20:58.000000000 
+0200
+++ new/betamax-0.8.0/betamax/matchers/query.py 2016-08-04 12:40:43.000000000 
+0200
@@ -18,7 +18,10 @@
 
     def to_dict(self, query):
         """Turn the query string into a dictionary."""
-        return parse_qs(query or '')  # Protect against None
+        return parse_qs(
+            query or '',  # Protect against None
+            keep_blank_values=True,
+        )
 
     def match(self, request, recorded_request):
         request_query_dict = self.to_dict(urlparse(request.url).query)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/betamax/options.py 
new/betamax-0.8.0/betamax/options.py
--- old/betamax-0.7.0/betamax/options.py        2016-04-29 17:06:30.000000000 
+0200
+++ new/betamax-0.8.0/betamax/options.py        2016-08-12 13:25:58.000000000 
+0200
@@ -1,4 +1,5 @@
 from .cassette import Cassette
+from .exceptions import InvalidOption, validation_error_map
 
 
 def validate_record(record):
@@ -19,9 +20,10 @@
 def validate_placeholders(placeholders):
     """Validate placeholders is a dict-like structure"""
     keys = ['placeholder', 'replace']
-    return all(
-        sorted(list(p.keys())) == keys for p in placeholders
-    )
+    try:
+        return all(sorted(list(p.keys())) == keys for p in placeholders)
+    except TypeError:
+        return False
 
 
 def translate_cassette_options():
@@ -84,8 +86,9 @@
     def validate(self):
         for key, value in list(self.data.items()):
             if key not in Options.valid_options:
-                del self[key]
+                raise InvalidOption('{0} is not a valid option'.format(key))
             else:
                 is_valid = Options.valid_options[key]
                 if not is_valid(value):
-                    del self[key]
+                    raise validation_error_map[key]('{0!r} is not valid'
+                                                    .format(value))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/betamax.egg-info/PKG-INFO 
new/betamax-0.8.0/betamax.egg-info/PKG-INFO
--- old/betamax-0.7.0/betamax.egg-info/PKG-INFO 2016-04-29 18:19:49.000000000 
+0200
+++ new/betamax-0.8.0/betamax.egg-info/PKG-INFO 2016-08-17 00:00:40.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: betamax
-Version: 0.7.0
+Version: 0.8.0
 Summary: A VCR imitation for python-requests
 Home-page: https://github.com/sigmavirus24/betamax
 Author: Ian Cordasco
@@ -98,6 +98,34 @@
         History
         =======
         
+        0.8.0 - 2016-08-16
+        ------------------
+        
+        - Add ``betamax_parametrized_recorder`` and 
``betamax_parametrized_session``
+          to our list of pytest fixtures so that users will have parametrized 
cassette
+          names when writing parametrized tests with our fixtures. (I wonder 
if I can
+          mention parametrization a bunch more times so I can say parametrize 
a lot in
+          this bullet note.)
+        - Add ``ValidationError`` and a set of subclasses for each possible 
validation
+          error.
+        - Raise ``InvalidOption`` on unknown cassette options rather than 
silently
+          ignoring extra options.
+        - Raise a subclass of ``ValidationError`` when a particular cassette 
option is
+          invalid, rather than silently ignoring the validation failure.
+        
+        0.7.2 - 2016-08-04
+        ------------------
+        
+        - Fix bug with query string matcher where query-strings without values 
(e.g.,
+          ``?foo&bar`` as opposed to ``?foo=1&bar=2``) were treated as if 
there were
+          no query string.
+        
+        0.7.1 - 2016-06-14
+        ------------------
+        
+        - Fix issue #108 by effectively copying the items in the 
match_requests_on
+          list into the match_options set on a Cassette instance
+        
         0.7.0 - 2016-04-29
         ------------------
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/betamax.egg-info/SOURCES.txt 
new/betamax-0.8.0/betamax.egg-info/SOURCES.txt
--- old/betamax-0.7.0/betamax.egg-info/SOURCES.txt      2016-04-29 
18:19:50.000000000 +0200
+++ new/betamax-0.8.0/betamax.egg-info/SOURCES.txt      2016-08-17 
00:00:42.000000000 +0200
@@ -58,6 +58,7 @@
 docs/usage_patterns.rst
 tests/__init__.py
 tests/conftest.py
+tests/cassettes/FakeBetamaxTestCase.test_fake.json
 tests/cassettes/GitHub_create_issue.json
 tests/cassettes/GitHub_emojis.json
 tests/cassettes/global_preserve_exact_body_bytes.json
@@ -70,6 +71,7 @@
 tests/cassettes/test.json
 tests/cassettes/test_replays_response_on_right_order.json
 
tests/cassettes/tests.integration.test_fixtures.TestPyTestFixtures.test_pytest_fixture.json
+tests/cassettes/tests.integration.test_fixtures.TestPyTestParametrizedFixtures.test_pytest_fixture[https:-httpbin.org-get].json
 tests/integration/__init__.py
 tests/integration/helper.py
 tests/integration/test_allow_playback_repeats.py
@@ -85,12 +87,14 @@
 tests/regression/test_cassettes_retain_global_configuration.py
 tests/regression/test_gzip_compression.py
 tests/regression/test_once_prevents_new_interactions.py
+tests/regression/test_requests_2_11_body_matcher.py
 tests/regression/test_works_with_digest_auth.py
 tests/unit/test_adapter.py
 tests/unit/test_betamax.py
 tests/unit/test_cassette.py
 tests/unit/test_configure.py
 tests/unit/test_decorator.py
+tests/unit/test_exceptions.py
 tests/unit/test_fixtures.py
 tests/unit/test_matchers.py
 tests/unit/test_options.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/docs/api.rst 
new/betamax-0.8.0/docs/api.rst
--- old/betamax-0.7.0/docs/api.rst      2015-07-16 03:00:31.000000000 +0200
+++ new/betamax-0.8.0/docs/api.rst      2016-08-16 23:56:48.000000000 +0200
@@ -157,8 +157,9 @@
 -----------------------------
 
 You may want to force betamax to preserve the exact bytes in the body of a 
-response (or request) instead of relying on the `opinions held by the library 
-<opinions>`_. In this case you have two ways of telling betamax to do this.
+response (or request) instead of relying on the :ref:`opinions held by the
+library <opinions>`. In this case you have two ways of telling betamax to do
+this.
 
 The first, is on a per-cassette basis, like so:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/setup.cfg new/betamax-0.8.0/setup.cfg
--- old/betamax-0.7.0/setup.cfg 2016-04-29 18:19:50.000000000 +0200
+++ new/betamax-0.8.0/setup.cfg 2016-08-17 00:00:42.000000000 +0200
@@ -2,7 +2,7 @@
 universal = 1
 
 [egg_info]
-tag_svn_revision = 0
 tag_build = 
 tag_date = 0
+tag_svn_revision = 0
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/betamax-0.7.0/tests/cassettes/FakeBetamaxTestCase.test_fake.json 
new/betamax-0.8.0/tests/cassettes/FakeBetamaxTestCase.test_fake.json
--- old/betamax-0.7.0/tests/cassettes/FakeBetamaxTestCase.test_fake.json        
1970-01-01 01:00:00.000000000 +0100
+++ new/betamax-0.8.0/tests/cassettes/FakeBetamaxTestCase.test_fake.json        
2016-08-10 12:45:01.000000000 +0200
@@ -0,0 +1 @@
+{"http_interactions": [], "recorded_with": "betamax/0.7.2"}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/betamax-0.7.0/tests/cassettes/tests.integration.test_fixtures.TestPyTestParametrizedFixtures.test_pytest_fixture[https:-httpbin.org-get].json
 
new/betamax-0.8.0/tests/cassettes/tests.integration.test_fixtures.TestPyTestParametrizedFixtures.test_pytest_fixture[https:-httpbin.org-get].json
--- 
old/betamax-0.7.0/tests/cassettes/tests.integration.test_fixtures.TestPyTestParametrizedFixtures.test_pytest_fixture[https:-httpbin.org-get].json
   1970-01-01 01:00:00.000000000 +0100
+++ 
new/betamax-0.8.0/tests/cassettes/tests.integration.test_fixtures.TestPyTestParametrizedFixtures.test_pytest_fixture[https:-httpbin.org-get].json
   2016-08-16 23:51:53.000000000 +0200
@@ -0,0 +1 @@
+{"recorded_with": "betamax/0.4.2", "http_interactions": [{"recorded_at": 
"2015-05-25T00:46:42", "response": {"body": {"encoding": null, "string": "{\n  
\"args\": {}, \n  \"headers\": {\n    \"Accept\": \"*/*\", \n    
\"Accept-Encoding\": \"gzip, deflate\", \n    \"Host\": \"httpbin.org\", \n    
\"User-Agent\": \"python-requests/2.6.0 CPython/3.4.2 Darwin/14.1.0\"\n  }, \n  
\"origin\": \"72.160.201.47\", \n  \"url\": \"https://httpbin.org/get\"\n}\n"}, 
"status": {"message": "OK", "code": 200}, "url": "https://httpbin.org/get";, 
"headers": {"connection": ["keep-alive"], "content-type": ["application/json"], 
"content-length": ["266"], "date": ["Mon, 25 May 2015 00:46:42 GMT"], 
"access-control-allow-origin": ["*"], "access-control-allow-credentials": 
["true"], "server": ["nginx"]}}, "request": {"method": "GET", "body": 
{"encoding": "utf-8", "string": ""}, "uri": "https://httpbin.org/get";, 
"headers": {"Connection": ["keep-alive"], "User-Agent": ["python-requests/2.6.0 
CPython/3.4.2 Darwin/14.1.0"], "Accept": ["*/*"], "Accept-Encoding": ["gzip, 
deflate"]}}}]}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/tests/integration/test_fixtures.py 
new/betamax-0.8.0/tests/integration/test_fixtures.py
--- old/betamax-0.7.0/tests/integration/test_fixtures.py        2015-07-16 
04:29:25.000000000 +0200
+++ new/betamax-0.8.0/tests/integration/test_fixtures.py        2016-08-16 
23:51:53.000000000 +0200
@@ -24,3 +24,28 @@
         """Exercise the fixture itself."""
         resp = betamax_session.get('https://httpbin.org/get')
         assert resp.ok
+
+
[email protected]('betamax_parametrized_session')
+class TestPyTestParametrizedFixtures:
+    @pytest.fixture(autouse=True)
+    def setup(self, request):
+        """After test hook to assert everything."""
+        def finalizer():
+            test_dir = os.path.abspath('.')
+            cassette_name = ('tests.integration.test_fixtures.'  # Module name
+                             'TestPyTestParametrizedFixtures.'  # Class name
+                             'test_pytest_fixture'  # Test function name
+                             '[https:-httpbin.org-get]'  # Parameter
+                             '.json')
+            file_name = os.path.join(test_dir, 'tests', 'cassettes',
+                                     cassette_name)
+            assert os.path.exists(file_name) is True
+
+        request.addfinalizer(finalizer)
+
+    @pytest.mark.parametrize('url', ('https://httpbin.org/get',))
+    def test_pytest_fixture(self, betamax_parametrized_session, url):
+        """Exercise the fixture itself."""
+        resp = betamax_parametrized_session.get(url)
+        assert resp.ok
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/betamax-0.7.0/tests/regression/test_requests_2_11_body_matcher.py 
new/betamax-0.8.0/tests/regression/test_requests_2_11_body_matcher.py
--- old/betamax-0.7.0/tests/regression/test_requests_2_11_body_matcher.py       
1970-01-01 01:00:00.000000000 +0100
+++ new/betamax-0.8.0/tests/regression/test_requests_2_11_body_matcher.py       
2016-08-11 22:39:18.000000000 +0200
@@ -0,0 +1,27 @@
+import os
+import unittest
+
+import pytest
+import requests
+
+from betamax import Betamax
+
+
+class TestRequests211BodyMatcher(unittest.TestCase):
+    def tearDown(self):
+        os.unlink('tests/cassettes/requests_2_11_body_matcher.json')
+
+    @pytest.mark.skipif(requests.__build__ < 0x020401,
+                        reason="No json keyword.")
+    def test_requests_with_json_body(self):
+        s = requests.Session()
+        with Betamax(s).use_cassette('requests_2_11_body_matcher',
+                                     match_requests_on=['body']):
+            r = s.post('https://httpbin.org/post', json={'a': 2})
+            assert r.json() is not None
+
+        s = requests.Session()
+        with Betamax(s).use_cassette('requests_2_11_body_matcher',
+                                     match_requests_on=['body']):
+            r = s.post('https://httpbin.org/post', json={'a': 2})
+            assert r.json() is not None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/tests/unit/test_cassette.py 
new/betamax-0.8.0/tests/unit/test_cassette.py
--- old/betamax-0.7.0/tests/unit/test_cassette.py       2016-04-29 
17:06:30.000000000 +0200
+++ new/betamax-0.8.0/tests/unit/test_cassette.py       2016-08-12 
13:25:58.000000000 +0200
@@ -3,6 +3,8 @@
 import unittest
 from datetime import datetime
 
+import pytest
+
 from betamax import __version__
 from betamax.cassette import cassette
 from betamax import mock_response
@@ -310,6 +312,12 @@
         assert i is not None
         assert self.interaction is i
 
+    def test_find_match__missing_matcher(self):
+        self.cassette.match_options = set(['uri', 'method', 'invalid'])
+        self.cassette.record_mode = 'none'
+        with pytest.raises(KeyError):
+            self.cassette.find_match(self.response.request)
+
     def test_eject(self):
         serializer = self.test_serializer
         self.cassette.eject()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/tests/unit/test_exceptions.py 
new/betamax-0.8.0/tests/unit/test_exceptions.py
--- old/betamax-0.7.0/tests/unit/test_exceptions.py     1970-01-01 
01:00:00.000000000 +0100
+++ new/betamax-0.8.0/tests/unit/test_exceptions.py     2016-08-12 
13:25:58.000000000 +0200
@@ -0,0 +1,35 @@
+import unittest
+import inspect
+
+from betamax import exceptions
+
+
+def exception_classes():
+    for _, module_object in inspect.getmembers(exceptions):
+        if inspect.isclass(module_object):
+            yield module_object
+
+
+class TestExceptions(unittest.TestCase):
+    def test_all_exceptions_are_betamax_errors(self):
+        for exception_class in exception_classes():
+            assert isinstance(exception_class('msg'), exceptions.BetamaxError)
+
+    def test_all_validation_errors_are_in_validation_error_map(self):
+        validation_error_map_values = exceptions.validation_error_map.values()
+        for exception_class in exception_classes():
+            if exception_class.__name__ == 'ValidationError' or \
+               not exception_class.__name__.endswith('ValidationError'):
+                continue
+            assert exception_class in validation_error_map_values
+
+    def test_all_validation_errors_are_validation_errors(self):
+        for exception_class in exception_classes():
+            if not exception_class.__name__.endswith('ValidationError'):
+                continue
+            assert isinstance(exception_class('msg'),
+                              exceptions.ValidationError)
+
+    def test_invalid_option_is_validation_error(self):
+        assert isinstance(exceptions.InvalidOption('msg'),
+                          exceptions.ValidationError)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/tests/unit/test_matchers.py 
new/betamax-0.8.0/tests/unit/test_matchers.py
--- old/betamax-0.7.0/tests/unit/test_matchers.py       2015-04-12 
22:43:22.000000000 +0200
+++ new/betamax-0.8.0/tests/unit/test_matchers.py       2016-08-04 
12:40:43.000000000 +0200
@@ -140,6 +140,9 @@
         )
         # Regression test (no query issue)
         assert match(self.p, {'uri': 'http://example.com'}) is False
+        # Regression test (query with no value)
+        self.p.url = 'https://example.com/?foo'
+        assert match(self.p, {'uri': 'https://httpbin.org/?foo'}) is True
 
     def test_uri_matcher(self):
         match = matchers.matcher_registry['uri'].match
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/betamax-0.7.0/tests/unit/test_options.py 
new/betamax-0.8.0/tests/unit/test_options.py
--- old/betamax-0.7.0/tests/unit/test_options.py        2013-09-14 
00:22:30.000000000 +0200
+++ new/betamax-0.8.0/tests/unit/test_options.py        2016-08-12 
13:25:58.000000000 +0200
@@ -1,5 +1,9 @@
 import unittest
 from itertools import permutations
+
+import pytest
+
+from betamax import exceptions
 from betamax.options import Options, validate_record, validate_matchers
 
 
@@ -31,21 +35,50 @@
         for key in self.data:
             assert key in self.options
 
-    def test_invalid_data_is_removed(self):
+    def test_raise_on_unknown_option(self):
         data = self.data.copy()
         data['fake'] = 'value'
-        options = Options(data)
+        with pytest.raises(exceptions.InvalidOption):
+            Options(data)
 
-        for key in self.data:
-            assert key in options
+    def test_raise_on_invalid_body_bytes(self):
+        data = self.data.copy()
+        data['preserve_exact_body_bytes'] = None
+        with pytest.raises(exceptions.BodyBytesValidationError):
+            Options(data)
+
+    def test_raise_on_invalid_matchers(self):
+        data = self.data.copy()
+        data['match_requests_on'] = ['foo', 'bar', 'bogus']
+        with pytest.raises(exceptions.MatchersValidationError):
+            Options(data)
 
-        assert 'fake' not in options
+    def test_raise_on_invalid_placeholders(self):
+        data = self.data.copy()
+        data['placeholders'] = None
+        with pytest.raises(exceptions.PlaceholdersValidationError):
+            Options(data)
 
-    def test_values_are_validated(self):
-        assert self.options['re_record_interval'] == 10000
-        assert self.options['match_requests_on'] == ['method']
+    def test_raise_on_invalid_playback_repeats(self):
+        data = self.data.copy()
+        data['allow_playback_repeats'] = None
+        with pytest.raises(exceptions.PlaybackRepeatsValidationError):
+            Options(data)
 
+    def test_raise_on_invalid_record(self):
         data = self.data.copy()
-        data['match_requests_on'] = ['foo', 'bar', 'bogus']
-        options = Options(data)
-        assert options['match_requests_on'] == ['method', 'uri']
+        data['record'] = None
+        with pytest.raises(exceptions.RecordValidationError):
+            Options(data)
+
+    def test_raise_on_invalid_record_interval(self):
+        data = self.data.copy()
+        data['re_record_interval'] = -1
+        with pytest.raises(exceptions.RecordIntervalValidationError):
+            Options(data)
+
+    def test_raise_on_invalid_serializer(self):
+        data = self.data.copy()
+        data['serialize_with'] = None
+        with pytest.raises(exceptions.SerializerValidationError):
+            Options(data)


Reply via email to