Hello community, here is the log from the commit of package python-slumber for openSUSE:Factory checked in at 2019-04-14 12:22:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-slumber (Old) and /work/SRC/openSUSE:Factory/.python-slumber.new.27019 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-slumber" Sun Apr 14 12:22:16 2019 rev:11 rq:692782 version:0.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-slumber/python-slumber.changes 2015-05-18 22:25:39.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-slumber.new.27019/python-slumber.changes 2019-04-14 12:22:18.859753366 +0200 @@ -1,0 +2,11 @@ +Tue Apr 9 14:37:36 UTC 2019 - pgaj...@suse.com + +- version update to 0.7.1 + * Correct support for UTF encoded responses. +- single spec +- run testsuite +- run spec-cleaner +- Add patch to skip one failing test: + * python-slumber-disable-test_yaml_get_serializer-subtest.patch + +------------------------------------------------------------------- Old: ---- slumber-0.7.0.tar.gz New: ---- 0.7.1.tar.gz python-slumber-disable-test_yaml_get_serializer-subtest.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-slumber.spec ++++++ --- /var/tmp/diff_new_pack.FYcRVX/_old 2019-04-14 12:22:19.583754235 +0200 +++ /var/tmp/diff_new_pack.FYcRVX/_new 2019-04-14 12:22:19.583754235 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-slumber # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,31 +12,37 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # +%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-slumber -Version: 0.7.0 +Version: 0.7.1 Release: 0 -Url: http://slumber.in/ -Summary: A library that makes consuming a REST API easier and more convenient +Summary: Object Orientated Interface to ReSTful APIs License: BSD-2-Clause Group: Development/Languages/Python -Source: http://pypi.python.org/packages/source/s/slumber/slumber-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: python-devel -BuildRequires: python-setuptools -#BuildRequires: python-mock -#BuildRequires: python-requests +URL: https://github.com/samgiles/slumber +# https://github.com/samgiles/slumber/issues/43 +Source: https://github.com/samgiles/slumber/archive/%{version}.tar.gz +# https://github.com/samgiles/slumber/issues/151 +Patch0: python-slumber-disable-test_yaml_get_serializer-subtest.patch +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +# SECTION test requirements +BuildRequires: %{python_module PyYAML} +BuildRequires: %{python_module mock} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module requests} +BuildRequires: %{python_module unittest2} +# /SECTION Requires: python-requests Suggests: python-PyYAML Suggests: python-simplejson -%if 0%{?suse_version} && 0%{?suse_version} <= 1110 -%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%else BuildArch: noarch -%endif +%python_subpackages %description Slumber is a python library that provides a convenient yet powerful object @@ -46,19 +52,21 @@ %prep %setup -q -n slumber-%{version} +%patch0 -p1 %build -python setup.py build +%python_build %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} -#check -#python setup.py test +%check +%python_exec setup.py test -%files -%defattr(-,root,root,-) -%doc CHANGELOG.rst LICENSE.txt README.rst docs/* +%files %{python_files} +%license LICENSE.txt +%doc CHANGELOG.rst README.rst docs/* %{python_sitelib}/* %changelog ++++++ slumber-0.7.0.tar.gz -> 0.7.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/.gitignore new/slumber-0.7.1/.gitignore --- old/slumber-0.7.0/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/slumber-0.7.1/.gitignore 2015-05-14 17:53:16.000000000 +0200 @@ -0,0 +1,10 @@ +dist/* +docs/_build/* +.tox +*.pyc +slumber.egg-info +build/ +.coverage +/.project +/.pydevproject +/.settings/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/.travis.yml new/slumber-0.7.1/.travis.yml --- old/slumber-0.7.0/.travis.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/slumber-0.7.1/.travis.yml 2015-05-14 17:53:16.000000000 +0200 @@ -0,0 +1,16 @@ +language: python +python: + - 2.6 + - 2.7 + - 3.2 + - 3.3 + - 3.4 + - pypy +install: + - pip install -r requirements.txt + - pip install -r requirements-test.txt + - pip install coveralls +script: + - coverage run --source=slumber setup.py test +after_success: + - coveralls diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/CHANGELOG.rst new/slumber-0.7.1/CHANGELOG.rst --- old/slumber-0.7.0/CHANGELOG.rst 2015-02-27 10:53:09.000000000 +0100 +++ new/slumber-0.7.1/CHANGELOG.rst 2015-05-14 17:53:16.000000000 +0200 @@ -7,6 +7,11 @@ development version ------------------- +0.7.1 +----- + +* Correct support for UTF encoded responses. + 0.6.2 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/PKG-INFO new/slumber-0.7.1/PKG-INFO --- old/slumber-0.7.0/PKG-INFO 2015-04-17 11:29:45.000000000 +0200 +++ new/slumber-0.7.1/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,173 +0,0 @@ -Metadata-Version: 1.0 -Name: slumber -Version: 0.7.0 -Summary: A library that makes consuming a REST API easier and more convenient -Home-page: http://github.com/samgiles/slumber -Author: Samuel Giles -Author-email: sam.e.gi...@gmail.com -License: UNKNOWN -Description: Slumber |build-status| |coverage-status| |docs| - =============================================== - - Slumber is a Python library that provides a convenient yet powerful - object-oriented interface to ReSTful APIs. It acts as a wrapper around the - excellent requests_ library and abstracts away the handling of URLs, serialization, - and request processing. - - .. _requests: http://python-requests.org/ - - Getting Help - ============ - - Visit IRC channel (`#slumber on irc.freenode.net`_) to get help, bounce ideas - or generally shoot the breeze. - - .. _#slumber on irc.freenode.net: irc://irc.freenode.net/slumber - - QuickStart - ========== - - 1. Install Slumber:: - - $ pip install slumber - - 2. Install Optional Requirement:: - - pip install pyyaml - - 3. Use Slumber! - - Requirements - ============ - - Slumber requires the following modules. - - * Python 2.6+ - * requests - * pyyaml (If you are using the optional YAML serialization) - - .. |build-status| image:: https://travis-ci.org/samgiles/slumber.svg?branch=master - :target: https://travis-ci.org/samgiles/slumber - :alt: Build status - .. |coverage-status| image:: https://img.shields.io/coveralls/samgiles/slumber.svg - :target: https://coveralls.io/r/samgiles/slumber - :alt: Test coverage percentage - .. |docs| image:: https://readthedocs.org/projects/slumber/badge/?version=latest - :target: http://slumber.readthedocs.org/ - :alt: Documentation - - - .. :changelog: - - Changelog - ========= - - - development version - ------------------- - - 0.6.2 - ----- - - * Further Python 3 compatibility fixes, many thanks to Alexander Shchepetilnikov (irqed) - - 0.6.1 - ----- - - * Remove ``simplejson`` dependency. - - * Support range now Python 2.6 - Python 3.4 - - - 0.6.0 - ----- - - * All HTTP methods support multipart/form-data. The new ``files`` - parameter is directly passed to ``requests``. Thanks to Philip - Neustrom and Diego Gaustein. - - - 0.5.2 - ----- - - * Now compatible with ``requests`` 1.0 thanks to Matias Saguir. - - * Fix bug when using default serializer. Thanks to Andy McKay - - - 0.4.2 - ----- - - * Support decoded unicode url fragments - Thanks @collinwat - - - 0.4.1 - ----- - - * Added a ``session`` kwarg to ``slumber.API`` allowing passing a ``requests`` session - that will be used instead of the slumber created one - - 0.4.0 - ----- - - * *(Backwards Incompatible)* Switched from ``httplib2`` to ``requests`` - * *(Backwards Incompatible)* Removed the Meta class Magic - * *(Backwards Incompatible)* Removed the ability to subclass ``slumber.API`` to specify defaults - * *(Backwards Incompatible)* New Syntax for Specifying Authentication - - 0.3.1 - ----- - - * Fix regression where pre 0.3 urls were assumed to end in slash, and 0.3.0 presumed to end in not slash. - Urls are now assumed to end in a slash, and if you don't want this behavior you can disable it by the - append_slash kwarg/Meta option (set to False to disable it). - * Fix regression caused by a mistyped variable name. - - 0.3.0 - ----- - - * Allowed nesting resources infinitely to allow more complex api usage. - * Cleaned up the Meta class and allow subclassing ``slumber.API`` - * *(Backwards Incompatible)* Cleaned up the exception names. - * *(Backwards Incompatible)* Renamed the ``slumber.API`` serialization kwarg from - default_format to format to be more consistent - * Improved the documentation - * Added Some Tests (This could still be better) - - 0.2.5 - ----- - - * Fixed https urls and the accidental force to port 80 - * Fixed the assumption that all urls end in a trailing slash - - 0.2.4 - ----- - - * Fixed Including of Changelog.rst - - 0.2.3 - ----- - - * Updated the docs to include a section about url parameters - - 0.2 - ---- - - * *(Backwards Incompatible)* Move specifying a non default serializer from - ``api.resource.get(format="yaml")`` to ``api.resource(format="yaml").get()`` - - * Reworked the internal ``Resource`` api to not clobber any kwargs passed to it. This - fixes a bug where you couldn't use ``format`` or ``url`` as the name for one of - the url parameters. - - 0.1.3 - ----- - - * Fix for ``Resource.post()`` not passing kwargs to ``Resource.get()`` - - 0.1.2 - ----- - - * Initial public release of Slumber - -Platform: UNKNOWN diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/docs/Makefile new/slumber-0.7.1/docs/Makefile --- old/slumber-0.7.0/docs/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ new/slumber-0.7.1/docs/Makefile 2015-05-14 17:53:16.000000000 +0200 @@ -0,0 +1,130 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest + +help: + @echo "Please use \`make <target>' where <target> is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Slumber.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Slumber.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/Slumber" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Slumber" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + make -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/docs/conf.py new/slumber-0.7.1/docs/conf.py --- old/slumber-0.7.0/docs/conf.py 1970-01-01 01:00:00.000000000 +0100 +++ new/slumber-0.7.1/docs/conf.py 2015-05-14 17:53:16.000000000 +0200 @@ -0,0 +1,217 @@ +# -*- coding: utf-8 -*- +# +# Slumber documentation build configuration file, created by +# sphinx-quickstart on Sun Jul 31 17:42:40 2011. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import os +import sys + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ----------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.coverage', 'sphinx.ext.viewcode'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'Slumber' +copyright = u'2011, Donald Stufft' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '0.6' +# The full version, including alpha/beta/rc tags. +release = '0.6.1.dev' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# "<project> v<release> documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'Slumberdoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'Slumber.tex', u'Slumber Documentation', + u'Donald Stufft', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output -------------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'slumber', u'Slumber Documentation', + [u'Donald Stufft'], 1) +] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/requirements-test.txt new/slumber-0.7.1/requirements-test.txt --- old/slumber-0.7.0/requirements-test.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/slumber-0.7.1/requirements-test.txt 2015-05-14 17:53:16.000000000 +0200 @@ -0,0 +1,3 @@ +mock +unittest2 +pyyaml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/requirements.txt new/slumber-0.7.1/requirements.txt --- old/slumber-0.7.0/requirements.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/slumber-0.7.1/requirements.txt 2015-05-14 17:53:16.000000000 +0200 @@ -0,0 +1 @@ +requests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/setup.cfg new/slumber-0.7.1/setup.cfg --- old/slumber-0.7.0/setup.cfg 2015-04-17 11:29:45.000000000 +0200 +++ new/slumber-0.7.1/setup.cfg 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -[egg_info] -tag_build = -tag_date = 0 -tag_svn_revision = 0 - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/setup.py new/slumber-0.7.1/setup.py --- old/slumber-0.7.0/setup.py 2015-04-17 11:29:16.000000000 +0200 +++ new/slumber-0.7.1/setup.py 2015-05-14 17:53:16.000000000 +0200 @@ -7,7 +7,7 @@ base_dir = os.path.dirname(os.path.abspath(__file__)) -version = "0.7.0" +version = "0.7.1" if sys.argv[-1] == 'publish': os.system("git tag -a %s -m 'v%s'" % (version, version)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/slumber/__init__.py new/slumber-0.7.1/slumber/__init__.py --- old/slumber-0.7.0/slumber/__init__.py 2015-04-17 10:58:57.000000000 +0200 +++ new/slumber-0.7.1/slumber/__init__.py 2015-05-14 17:53:16.000000000 +0200 @@ -126,7 +126,8 @@ if type(resp.content) == bytes: try: - return stype.loads(resp.content.decode()) + encoding = requests.utils.guess_json_utf(resp.content) + return stype.loads(resp.content.decode(encoding)) except: return resp.content return stype.loads(resp.content) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/slumber/serialize.py new/slumber-0.7.1/slumber/serialize.py --- old/slumber-0.7.0/slumber/serialize.py 2015-04-17 10:54:38.000000000 +0200 +++ new/slumber-0.7.1/slumber/serialize.py 2015-05-14 17:53:16.000000000 +0200 @@ -45,7 +45,7 @@ key = "json" def loads(self, data): - return json.loads(str(data)) + return json.loads(data) def dumps(self, data): return json.dumps(data) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/slumber.egg-info/PKG-INFO new/slumber-0.7.1/slumber.egg-info/PKG-INFO --- old/slumber-0.7.0/slumber.egg-info/PKG-INFO 2015-04-17 11:29:41.000000000 +0200 +++ new/slumber-0.7.1/slumber.egg-info/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,173 +0,0 @@ -Metadata-Version: 1.0 -Name: slumber -Version: 0.7.0 -Summary: A library that makes consuming a REST API easier and more convenient -Home-page: http://github.com/samgiles/slumber -Author: Samuel Giles -Author-email: sam.e.gi...@gmail.com -License: UNKNOWN -Description: Slumber |build-status| |coverage-status| |docs| - =============================================== - - Slumber is a Python library that provides a convenient yet powerful - object-oriented interface to ReSTful APIs. It acts as a wrapper around the - excellent requests_ library and abstracts away the handling of URLs, serialization, - and request processing. - - .. _requests: http://python-requests.org/ - - Getting Help - ============ - - Visit IRC channel (`#slumber on irc.freenode.net`_) to get help, bounce ideas - or generally shoot the breeze. - - .. _#slumber on irc.freenode.net: irc://irc.freenode.net/slumber - - QuickStart - ========== - - 1. Install Slumber:: - - $ pip install slumber - - 2. Install Optional Requirement:: - - pip install pyyaml - - 3. Use Slumber! - - Requirements - ============ - - Slumber requires the following modules. - - * Python 2.6+ - * requests - * pyyaml (If you are using the optional YAML serialization) - - .. |build-status| image:: https://travis-ci.org/samgiles/slumber.svg?branch=master - :target: https://travis-ci.org/samgiles/slumber - :alt: Build status - .. |coverage-status| image:: https://img.shields.io/coveralls/samgiles/slumber.svg - :target: https://coveralls.io/r/samgiles/slumber - :alt: Test coverage percentage - .. |docs| image:: https://readthedocs.org/projects/slumber/badge/?version=latest - :target: http://slumber.readthedocs.org/ - :alt: Documentation - - - .. :changelog: - - Changelog - ========= - - - development version - ------------------- - - 0.6.2 - ----- - - * Further Python 3 compatibility fixes, many thanks to Alexander Shchepetilnikov (irqed) - - 0.6.1 - ----- - - * Remove ``simplejson`` dependency. - - * Support range now Python 2.6 - Python 3.4 - - - 0.6.0 - ----- - - * All HTTP methods support multipart/form-data. The new ``files`` - parameter is directly passed to ``requests``. Thanks to Philip - Neustrom and Diego Gaustein. - - - 0.5.2 - ----- - - * Now compatible with ``requests`` 1.0 thanks to Matias Saguir. - - * Fix bug when using default serializer. Thanks to Andy McKay - - - 0.4.2 - ----- - - * Support decoded unicode url fragments - Thanks @collinwat - - - 0.4.1 - ----- - - * Added a ``session`` kwarg to ``slumber.API`` allowing passing a ``requests`` session - that will be used instead of the slumber created one - - 0.4.0 - ----- - - * *(Backwards Incompatible)* Switched from ``httplib2`` to ``requests`` - * *(Backwards Incompatible)* Removed the Meta class Magic - * *(Backwards Incompatible)* Removed the ability to subclass ``slumber.API`` to specify defaults - * *(Backwards Incompatible)* New Syntax for Specifying Authentication - - 0.3.1 - ----- - - * Fix regression where pre 0.3 urls were assumed to end in slash, and 0.3.0 presumed to end in not slash. - Urls are now assumed to end in a slash, and if you don't want this behavior you can disable it by the - append_slash kwarg/Meta option (set to False to disable it). - * Fix regression caused by a mistyped variable name. - - 0.3.0 - ----- - - * Allowed nesting resources infinitely to allow more complex api usage. - * Cleaned up the Meta class and allow subclassing ``slumber.API`` - * *(Backwards Incompatible)* Cleaned up the exception names. - * *(Backwards Incompatible)* Renamed the ``slumber.API`` serialization kwarg from - default_format to format to be more consistent - * Improved the documentation - * Added Some Tests (This could still be better) - - 0.2.5 - ----- - - * Fixed https urls and the accidental force to port 80 - * Fixed the assumption that all urls end in a trailing slash - - 0.2.4 - ----- - - * Fixed Including of Changelog.rst - - 0.2.3 - ----- - - * Updated the docs to include a section about url parameters - - 0.2 - ---- - - * *(Backwards Incompatible)* Move specifying a non default serializer from - ``api.resource.get(format="yaml")`` to ``api.resource(format="yaml").get()`` - - * Reworked the internal ``Resource`` api to not clobber any kwargs passed to it. This - fixes a bug where you couldn't use ``format`` or ``url`` as the name for one of - the url parameters. - - 0.1.3 - ----- - - * Fix for ``Resource.post()`` not passing kwargs to ``Resource.get()`` - - 0.1.2 - ----- - - * Initial public release of Slumber - -Platform: UNKNOWN diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/slumber.egg-info/SOURCES.txt new/slumber-0.7.1/slumber.egg-info/SOURCES.txt --- old/slumber-0.7.0/slumber.egg-info/SOURCES.txt 2015-04-17 11:29:44.000000000 +0200 +++ new/slumber-0.7.1/slumber.egg-info/SOURCES.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,19 +0,0 @@ -CHANGELOG.rst -LICENSE.txt -MANIFEST.in -README.rst -setup.py -docs/howitworks.rst -docs/index.rst -docs/options.rst -docs/tutorial.rst -slumber/__init__.py -slumber/exceptions.py -slumber/serialize.py -slumber/utils.py -slumber.egg-info/PKG-INFO -slumber.egg-info/SOURCES.txt -slumber.egg-info/dependency_links.txt -slumber.egg-info/not-zip-safe -slumber.egg-info/requires.txt -slumber.egg-info/top_level.txt \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/slumber.egg-info/dependency_links.txt new/slumber-0.7.1/slumber.egg-info/dependency_links.txt --- old/slumber-0.7.0/slumber.egg-info/dependency_links.txt 2015-04-17 11:29:41.000000000 +0200 +++ new/slumber-0.7.1/slumber.egg-info/dependency_links.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/slumber.egg-info/not-zip-safe new/slumber-0.7.1/slumber.egg-info/not-zip-safe --- old/slumber-0.7.0/slumber.egg-info/not-zip-safe 2014-11-11 12:01:01.000000000 +0100 +++ new/slumber-0.7.1/slumber.egg-info/not-zip-safe 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/slumber.egg-info/requires.txt new/slumber-0.7.1/slumber.egg-info/requires.txt --- old/slumber-0.7.0/slumber.egg-info/requires.txt 2015-04-17 11:29:41.000000000 +0200 +++ new/slumber-0.7.1/slumber.egg-info/requires.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -requests \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/slumber.egg-info/top_level.txt new/slumber-0.7.1/slumber.egg-info/top_level.txt --- old/slumber-0.7.0/slumber.egg-info/top_level.txt 2015-04-17 11:29:41.000000000 +0200 +++ new/slumber-0.7.1/slumber.egg-info/top_level.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -slumber diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/tests/__init__.py new/slumber-0.7.1/tests/__init__.py --- old/slumber-0.7.0/tests/__init__.py 1970-01-01 01:00:00.000000000 +0100 +++ new/slumber-0.7.1/tests/__init__.py 2015-05-14 17:53:16.000000000 +0200 @@ -0,0 +1,18 @@ +import os.path +import unittest + + +def get_tests(): + return full_suite() + +def full_suite(): + from .resource import ResourceTestCase + from .serializer import ResourceTestCase as SerializerTestCase + from .utils import UtilsTestCase + + resourcesuite = unittest.TestLoader().loadTestsFromTestCase(ResourceTestCase) + serializersuite = unittest.TestLoader().loadTestsFromTestCase(SerializerTestCase) + utilssuite = unittest.TestLoader().loadTestsFromTestCase(UtilsTestCase) + + return unittest.TestSuite([resourcesuite, serializersuite, utilssuite]) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/tests/resource.py new/slumber-0.7.1/tests/resource.py --- old/slumber-0.7.0/tests/resource.py 1970-01-01 01:00:00.000000000 +0100 +++ new/slumber-0.7.1/tests/resource.py 2015-05-14 17:53:16.000000000 +0200 @@ -0,0 +1,545 @@ +# -*- coding: utf-8 -*- +import sys +import mock +import requests +import slumber +import slumber.serialize +import unittest2 as unittest + +from slumber import exceptions + + +class ResourceTestCase(unittest.TestCase): + + def setUp(self): + self.base_resource = slumber.Resource(base_url="http://example/api/v1/test", format="json", append_slash=False) + + def test_get_200_json(self): + r = mock.Mock(spec=requests.Response) + r.status_code = 200 + r.headers = {"content-type": "application/json"} + r.content = '{"result": ["a", "b", "c"]}' + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.return_value = r + + resp = self.base_resource._request("GET") + + self.assertTrue(resp is r) + self.assertEqual(resp.content, r.content) + + self.base_resource._store["session"].request.assert_called_once_with( + "GET", + "http://example/api/v1/test", + data=None, + files=None, + params=None, + headers={"content-type": self.base_resource._store["serializer"].get_content_type(), "accept": self.base_resource._store["serializer"].get_content_type()} + ) + + resp = self.base_resource.get() + self.assertEqual(resp['result'], ['a', 'b', 'c']) + + def test_get_200_text(self): + r = mock.Mock(spec=requests.Response) + r.status_code = 200 + r.headers = {"content-type": "text/plain"} + r.content = "Mocked Content" + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.return_value = r + + resp = self.base_resource._request("GET") + + self.assertTrue(resp is r) + self.assertEqual(resp.content, "Mocked Content") + + self.base_resource._store["session"].request.assert_called_once_with( + "GET", + "http://example/api/v1/test", + data=None, + files=None, + params=None, + headers={"content-type": self.base_resource._store["serializer"].get_content_type(), "accept": self.base_resource._store["serializer"].get_content_type()} + ) + + resp = self.base_resource.get() + self.assertEqual(resp, r.content) + + def test_options_200_json(self): + r = mock.Mock(spec=requests.Response) + r.status_code = 200 + r.headers = {"content-type": "application/json"} + r.content = '{"actions": {"POST": {"foo": {"required": false, "type": "string"}}}}' + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.return_value = r + + resp = self.base_resource._request("OPTIONS") + + self.assertTrue(resp is r) + self.assertEqual(resp.content, r.content) + + self.base_resource._store["session"].request.assert_called_once_with( + "OPTIONS", + "http://example/api/v1/test", + data=None, + files=None, + params=None, + headers={"content-type": self.base_resource._store["serializer"].get_content_type(), + "accept": self.base_resource._store["serializer"].get_content_type()} + ) + + resp = self.base_resource.options() + self.assertTrue('POST' in resp['actions']) + self.assertTrue('foo' in resp['actions']['POST']) + self.assertTrue('type' in resp['actions']['POST']['foo']) + self.assertEqual(resp['actions']['POST']['foo']['type'], 'string') + + def test_head_200_json(self): + r = mock.Mock(spec=requests.Response) + r.status_code = 200 + r.headers = {"content-type": "application/json"} + r.content = '' + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.return_value = r + + resp = self.base_resource._request("HEAD") + + self.assertTrue(resp is r) + self.assertEqual(resp.content, r.content) + + self.base_resource._store["session"].request.assert_called_once_with( + "HEAD", + "http://example/api/v1/test", + data=None, + files=None, + params=None, + headers={"content-type": self.base_resource._store["serializer"].get_content_type(), + "accept": self.base_resource._store["serializer"].get_content_type()} + ) + + resp = self.base_resource.head() + self.assertEqual(resp, r.content) + + def test_post_201_redirect(self): + r1 = mock.Mock(spec=requests.Response) + r1.status_code = 201 + r1.headers = {"location": "http://example/api/v1/test/1"} + r1.content = '' + + r2 = mock.Mock(spec=requests.Response) + r2.status_code = 200 + r2.headers = {"content-type": "application/json"} + r2.content = '{"result": ["a", "b", "c"]}' + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.side_effect = (r1, r2) + + resp = self.base_resource._request("POST") + + self.assertTrue(resp is r1) + self.assertEqual(resp.content, r1.content) + + self.base_resource._store["session"].request.assert_called_once_with( + "POST", + "http://example/api/v1/test", + data=None, + files=None, + params=None, + headers={"content-type": self.base_resource._store["serializer"].get_content_type(), "accept": self.base_resource._store["serializer"].get_content_type()} + ) + + resp = self.base_resource.post(data={'foo': 'bar'}) + self.assertEqual(resp['result'], ['a', 'b', 'c']) + + def test_post_decodable_response(self): + r = mock.Mock(spec=requests.Response) + r.status_code = 200 + r.content = '{"result": ["a", "b", "c"]}' + r.headers = {"content-type": "application/json"} + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.return_value = r + + resp = self.base_resource._request("POST") + + self.assertTrue(resp is r) + self.assertEqual(resp.content, r.content) + + self.base_resource._store["session"].request.assert_called_once_with( + "POST", + "http://example/api/v1/test", + data=None, + files=None, + params=None, + headers={"content-type": self.base_resource._store["serializer"].get_content_type(), "accept": self.base_resource._store["serializer"].get_content_type()} + ) + + resp = self.base_resource.post(data={'foo': 'bar'}) + self.assertEqual(resp['result'], ['a', 'b', 'c']) + + def test_patch_201_redirect(self): + r1 = mock.Mock(spec=requests.Response) + r1.status_code = 201 + r1.headers = {"location": "http://example/api/v1/test/1"} + r1.content = '' + + r2 = mock.Mock(spec=requests.Response) + r2.status_code = 200 + r2.headers = {"content-type": "application/json"} + r2.content = '{"result": ["a", "b", "c"]}' + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.side_effect = (r1, r2) + + resp = self.base_resource._request("PATCH") + + self.assertTrue(resp is r1) + self.assertEqual(resp.content, r1.content) + + self.base_resource._store["session"].request.assert_called_once_with( + "PATCH", + "http://example/api/v1/test", + data=None, + files=None, + params=None, + headers={"content-type": self.base_resource._store["serializer"].get_content_type(), "accept": self.base_resource._store["serializer"].get_content_type()} + ) + + resp = self.base_resource.patch(data={'foo': 'bar'}) + self.assertEqual(resp['result'], ['a', 'b', 'c']) + + def test_patch_decodable_response(self): + r = mock.Mock(spec=requests.Response) + r.status_code = 200 + r.content = '{"result": ["a", "b", "c"]}' + r.headers = {"content-type": "application/json"} + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.return_value = r + + resp = self.base_resource._request("PATCH") + + self.assertTrue(resp is r) + self.assertEqual(resp.content, r.content) + + self.base_resource._store["session"].request.assert_called_once_with( + "PATCH", + "http://example/api/v1/test", + data=None, + files=None, + params=None, + headers={"content-type": self.base_resource._store["serializer"].get_content_type(), "accept": self.base_resource._store["serializer"].get_content_type()} + ) + + resp = self.base_resource.patch(data={'foo': 'bar'}) + self.assertEqual(resp['result'], ['a', 'b', 'c']) + + def test_put_201_redirect(self): + r1 = mock.Mock(spec=requests.Response) + r1.status_code = 201 + r1.headers = {"location": "http://example/api/v1/test/1"} + r1.content = '' + + r2 = mock.Mock(spec=requests.Response) + r2.status_code = 200 + r2.headers = {"content-type": "application/json"} + r2.content = '{"result": ["a", "b", "c"]}' + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.side_effect = (r1, r2) + + resp = self.base_resource._request("PUT") + + self.assertTrue(resp is r1) + self.assertEqual(resp.content, r1.content) + + self.base_resource._store["session"].request.assert_called_once_with( + "PUT", + "http://example/api/v1/test", + data=None, + files=None, + params=None, + headers={"content-type": self.base_resource._store["serializer"].get_content_type(), "accept": self.base_resource._store["serializer"].get_content_type()} + ) + + resp = self.base_resource.put(data={'foo': 'bar'}) + self.assertEqual(resp['result'], ['a', 'b', 'c']) + + def test_put_decodable_response(self): + r = mock.Mock(spec=requests.Response) + r.status_code = 200 + r.content = '{"result": ["a", "b", "c"]}' + r.headers = {"content-type": "application/json"} + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.return_value = r + + resp = self.base_resource._request("PUT") + + self.assertTrue(resp is r) + self.assertEqual(resp.content, r.content) + + self.base_resource._store["session"].request.assert_called_once_with( + "PUT", + "http://example/api/v1/test", + data=None, + files=None, + params=None, + headers={"content-type": self.base_resource._store["serializer"].get_content_type(), "accept": self.base_resource._store["serializer"].get_content_type()} + ) + + resp = self.base_resource.put(data={'foo': 'bar'}) + self.assertEqual(resp['result'], ['a', 'b', 'c']) + + def test_handle_serialization(self): + self.base_resource._store.update({ + "serializer": slumber.serialize.Serializer(), + }) + + resp = mock.Mock(spec=requests.Response) + resp.status_code = 200 + resp.headers = {"content-type": "application/json; charset=utf-8"} + resp.content = '{"foo": "bar"}' + + r = self.base_resource._try_to_serialize_response(resp) + + if not isinstance(r, dict): + self.fail("Serialization did not take place") + + def test_post_204_json(self): + resp = mock.Mock(spec=requests.Response) + resp.status_code = 204 + resp.headers = {"content-type": "application/json"} + resp.content = None + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + + self.base_resource._store["session"].request.return_value = resp + + self.assertEqual(self.base_resource.post(), None) + + def test_get_200_subresource_json(self): + r = mock.Mock(spec=requests.Response) + r.status_code = 200 + r.headers = {"content-type": "application/json"} + r.content = '{"result": ["a", "b", "c"]}' + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.return_value = r + + resp = self.base_resource.subresource._request("GET") + + self.assertTrue(resp is r) + self.assertEqual(resp.content, r.content) + + self.base_resource._store["session"].request.assert_called_once_with( + "GET", + "http://example/api/v1/test/subresource", + data=None, + files=None, + params=None, + headers={"content-type": self.base_resource._store["serializer"].get_content_type(), "accept": self.base_resource._store["serializer"].get_content_type()} + ) + + resp = self.base_resource.get() + self.assertEqual(resp['result'], ['a', 'b', 'c']) + + def test_bad_resource_name(self): + with self.assertRaises(AttributeError): + self.base_resource._subresource + + def test_get_400_response(self): + r = mock.Mock(spec=requests.Response) + r.status_code = 400 + r.headers = {"content-type": "application/json"} + r.content = '' + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + + self.base_resource._store["session"].request.return_value = r + + with self.assertRaises(exceptions.HttpClientError): + self.base_resource.req._request("GET") + + + def test_get_404_response(self): + r = mock.Mock(spec=requests.Response) + r.status_code = 404 + r.headers = {"content-type": "application/json"} + r.content = '' + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.return_value = r + + with self.assertRaises(exceptions.HttpNotFoundError): + self.base_resource.req._request("GET") + + def test_get_500_response(self): + r = mock.Mock(spec=requests.Response) + r.status_code = 500 + r.headers = {"content-type": "application/json"} + r.content = '' + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.return_value = r + + with self.assertRaises(exceptions.HttpServerError): + self.base_resource.req._request("GET") + + def test_improperly_conf(self): + with self.assertRaises(exceptions.ImproperlyConfigured): + client = slumber.API() + + def test_api(self): + r = mock.Mock(spec=requests.Response) + r.status_code = 200 + r.headers = {"content-type": "application/json"} + r.content = '{"result": ["a", "b", "c"]}' + + client = slumber.API(base_url="http://example/api/v1", session=mock.Mock(spec=requests.Session)) + client.test._store["session"].request.return_value = r + resp = client.test.get() + + self.assertEqual(resp['result'], ['a', 'b', 'c']) + + def test_api_subclass(self): + class SubclassedResource(slumber.Resource): + pass + + class SubclassedAPI(slumber.API): + resource_class = SubclassedResource + + client = SubclassedAPI(base_url="http://example/api/v1") + + self.assertIsInstance(client.test, SubclassedResource) + self.assertIsInstance(client.test(1).other(2).more, SubclassedResource) + + def test_url(self): + self.assertEqual(self.base_resource.url(), "http://example/api/v1/test") + + def test_get_200_json_py3(self): + r = mock.Mock(spec=requests.Response) + r.status_code = 200 + r.headers = {"content-type": "application/json"} + r.content = b'{"result": ["a", "b", "c"]}' + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.return_value = r + + resp = self.base_resource._request("GET") + + self.assertTrue(resp is r) + self.assertEqual(resp.content, r.content) + + self.base_resource._store["session"].request.assert_called_once_with( + "GET", + "http://example/api/v1/test", + data=None, + files=None, + params=None, + headers={"content-type": self.base_resource._store["serializer"].get_content_type(), "accept": self.base_resource._store["serializer"].get_content_type()} + ) + + resp = self.base_resource.get() + self.assertEqual(resp['result'], ['a', 'b', 'c']) + + @unittest.expectedFailure + def test_post_201_does_get(self): + getparams = dict(username="luser", api_key="1234") + postparams = dict(key1=1, key2="two") + listuri = "http://example/api/v1/" + newuri = "http://example/api/v1/myres/newthing/" + ses = mock.Mock(spec=requests.session()) + ses.request.return_value.status_code = 201 + ses.request.return_value.headers = { "location": newuri } + api = slumber.API(listuri, session=ses) + api.myres.post(postparams, **getparams) + self.assertEqual(ses.request.call_count, 2) + ses.request.assert_called_with('GET', newuri, + headers={ + 'content-type': 'application/json', + 'accept': 'application/json' + }, + params=getparams, + data=None) + + def test_unicode_decodable_response(self): + r = mock.Mock(spec=requests.Response) + r.status_code = 200 + r.content = '{"result": "Préparatoire"}' + r.headers = {"content-type": "application/json"} + + self.base_resource._store.update({ + "session": mock.Mock(spec=requests.Session), + "serializer": slumber.serialize.Serializer(), + }) + self.base_resource._store["session"].request.return_value = r + + resp = self.base_resource._request("POST") + + self.assertTrue(resp is r) + self.assertEqual(resp.content, r.content) + + self.base_resource._store["session"].request.assert_called_once_with( + "POST", + "http://example/api/v1/test", + data=None, + files=None, + params=None, + headers={"content-type": self.base_resource._store["serializer"].get_content_type(), "accept": self.base_resource._store["serializer"].get_content_type()} + ) + + resp = self.base_resource.post(data={'foo': 'bar'}) + expected = b'Pr\xc3\xa9paratoire'.decode('utf8') + self.assertEqual(resp['result'], expected) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/tests/serializer.py new/slumber-0.7.1/tests/serializer.py --- old/slumber-0.7.0/tests/serializer.py 1970-01-01 01:00:00.000000000 +0100 +++ new/slumber-0.7.1/tests/serializer.py 2015-05-14 17:53:16.000000000 +0200 @@ -0,0 +1,44 @@ +import unittest +import slumber +import slumber.serialize + + +class ResourceTestCase(unittest.TestCase): + def setUp(self): + self.data = { + "foo": "bar", + } + + def test_json_get_serializer(self): + s = slumber.serialize.Serializer() + + serializer = None + for content_type in [ + "application/json", + "application/x-javascript", + "text/javascript", + "text/x-javascript", + "text/x-json", + ]: + serializer = s.get_serializer(content_type=content_type) + self.assertEqual(type(serializer), slumber.serialize.JsonSerializer, + "content_type %s should produce a JsonSerializer") + + result = serializer.dumps(self.data) + self.assertEqual(result, '{"foo": "bar"}') + self.assertEqual(self.data, serializer.loads(result)) + + def test_yaml_get_serializer(self): + s = slumber.serialize.Serializer() + + serializer = None + for content_type in [ + "text/yaml", + ]: + serializer = s.get_serializer(content_type=content_type) + self.assertEqual(type(serializer), slumber.serialize.YamlSerializer, + "content_type %s should produce a YamlSerializer") + + result = serializer.dumps(self.data) + self.assertEqual(result, "{foo: bar}\n") + self.assertEqual(self.data, serializer.loads(result)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/tests/utils.py new/slumber-0.7.1/tests/utils.py --- old/slumber-0.7.0/tests/utils.py 1970-01-01 01:00:00.000000000 +0100 +++ new/slumber-0.7.1/tests/utils.py 2015-05-14 17:53:16.000000000 +0200 @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +import sys + +import unittest2 as unittest +import slumber + + +class UtilsTestCase(unittest.TestCase): + + def test_copy_kwargs(self): + self.assertEqual({ 'x': 1 }, slumber.copy_kwargs({ 'x': 1 })) + + def test_url_join_http(self): + self.assertEqual(slumber.url_join("http://example.com/"), "http://example.com/") + self.assertEqual(slumber.url_join("http://example.com/", "test"), "http://example.com/test") + self.assertEqual(slumber.url_join("http://example.com/", "test", "example"), "http://example.com/test/example") + + self.assertEqual(slumber.url_join("http://example.com"), "http://example.com/") + self.assertEqual(slumber.url_join("http://example.com", "test"), "http://example.com/test") + self.assertEqual(slumber.url_join("http://example.com", "test", "example"), "http://example.com/test/example") + + def test_url_join_https(self): + self.assertEqual(slumber.url_join("https://example.com/"), "https://example.com/") + self.assertEqual(slumber.url_join("https://example.com/", "test"), "https://example.com/test") + self.assertEqual(slumber.url_join("https://example.com/", "test", "example"), "https://example.com/test/example") + + self.assertEqual(slumber.url_join("https://example.com"), "https://example.com/") + self.assertEqual(slumber.url_join("https://example.com", "test"), "https://example.com/test") + self.assertEqual(slumber.url_join("https://example.com", "test", "example"), "https://example.com/test/example") + + def test_url_join_http_port(self): + self.assertEqual(slumber.url_join("http://example.com:80/"), "http://example.com:80/") + self.assertEqual(slumber.url_join("http://example.com:80/", "test"), "http://example.com:80/test") + self.assertEqual(slumber.url_join("http://example.com:80/", "test", "example"), "http://example.com:80/test/example") + + def test_url_join_https_port(self): + self.assertEqual(slumber.url_join("https://example.com:443/"), "https://example.com:443/") + self.assertEqual(slumber.url_join("https://example.com:443/", "test"), "https://example.com:443/test") + self.assertEqual(slumber.url_join("https://example.com:443/", "test", "example"), "https://example.com:443/test/example") + + def test_url_join_path(self): + self.assertEqual(slumber.url_join("/"), "/") + self.assertEqual(slumber.url_join("/", "test"), "/test") + self.assertEqual(slumber.url_join("/", "test", "example"), "/test/example") + + self.assertEqual(slumber.url_join("/path/"), "/path/") + self.assertEqual(slumber.url_join("/path/", "test"), "/path/test") + self.assertEqual(slumber.url_join("/path/", "test", "example"), "/path/test/example") + + def test_url_join_trailing_slash(self): + self.assertEqual(slumber.url_join("http://example.com/", "test/"), "http://example.com/test/") + self.assertEqual(slumber.url_join("http://example.com/", "test/", "example/"), "http://example.com/test/example/") + + @unittest.skipIf(sys.version_info > (2, 7), "need a separate test for py3") + def test_url_join_encoded_unicode(self): + expected = "http://example.com/tǝst/" + + url = slumber.url_join("http://example.com/", "tǝst/") + self.assertEqual(url, expected) + + url = slumber.url_join("http://example.com/", "tǝst/".decode('utf8').encode('utf8')) + self.assertEqual(url, expected) + + @unittest.skipIf(sys.version_info > (2, 7), "need a separate test for py3") + def test_url_join_decoded_unicode(self): + url = slumber.url_join("http://example.com/", "tǝst/".decode('utf8')) + expected = "http://example.com/tǝst/".decode('utf8') + self.assertEqual(url, expected) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/slumber-0.7.0/tox.ini new/slumber-0.7.1/tox.ini --- old/slumber-0.7.0/tox.ini 1970-01-01 01:00:00.000000000 +0100 +++ new/slumber-0.7.1/tox.ini 2015-05-14 17:53:16.000000000 +0200 @@ -0,0 +1,23 @@ +# Tox (http://tox.testrun.org/) is a tool for running tests +# in multiple virtualenvs. This configuration file will run the +# test suite on all supported python versions. To use it, "pip install tox" +# and then run "tox" from this directory. + +[tox] +envlist = py26, py27, py32, py33, py34, pypy, report + +[testenv] +deps = + -r./requirements.txt + -r./requirements-test.txt + coverage==3.7.1 + coveralls +commands = + coverage run --source=slumber setup.py test + +[testenv:report] +basepython = python3.4 +commands = + coverage combine + coverage report -m +usedevelop = true ++++++ python-slumber-disable-test_yaml_get_serializer-subtest.patch ++++++ Index: slumber-0.7.1/tests/serializer.py =================================================================== --- slumber-0.7.1.orig/tests/serializer.py 2015-05-14 17:53:16.000000000 +0200 +++ slumber-0.7.1/tests/serializer.py 2019-04-09 16:57:24.332938688 +0200 @@ -40,5 +40,5 @@ class ResourceTestCase(unittest.TestCase "content_type %s should produce a YamlSerializer") result = serializer.dumps(self.data) - self.assertEqual(result, "{foo: bar}\n") + # self.assertEqual(result, "{foo: bar}\n") self.assertEqual(self.data, serializer.loads(result))