From 14e7f95d724072937317d13196c8206e3eb57566 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Tue, 15 May 2018 18:57:11 +0000 Subject: [PATCH 01/46] Update README. --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index ab8a42e..d841a40 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,24 @@ -Flask-Autodoc +Flask-Selfdoc ============= -Flask-Autodoc is a Flask extension that automatically creates documentation for your endpoints based on the routes, function arguments and docstrings. +Flask-Selfdoc is a Flask extension that automatically creates documentation for your endpoints based on the routes, function arguments and docstrings. It was forked from Flask-Autodoc, written by Arnaud Coomans, and is completely compatible as a replacement for that extension. -[![Build](https://api.travis-ci.org/acoomans/flask-autodoc.png)](https://travis-ci.org/acoomans/flask-autodoc) -[![Pypi version](http://img.shields.io/pypi/v/flask-autodoc.svg)](https://pypi.python.org/pypi/Flask-Autodoc) -[![Pypi license](http://img.shields.io/pypi/l/flask-autodoc.svg)](https://pypi.python.org/pypi/Flask-Autodoc) +[![Build](https://api.travis-ci.org/jwg4/flask-autodoc.png)](https://travis-ci.org/jwg4/flask-autodoc) +[![Pypi version](http://img.shields.io/pypi/v/flask-autodoc.svg)](https://pypi.python.org/pypi/Flask-Selfdoc) +[![Pypi license](http://img.shields.io/pypi/l/flask-selfdoc.svg)](https://pypi.python.org/pypi/Flask-Selfdoc) ![Python 2](http://img.shields.io/badge/python-2-blue.svg) ![Python 3](http://img.shields.io/badge/python-3-blue.svg) ## Requirements -Flask-Autodoc is compatible with Python versions 2 and 3; and it depends only on Flask. +Flask-Selfdoc is compatible with Python versions 2 and 3; and it depends only on Flask. ## Install -To install Flask-Autodoc, run pip: +To install Flask-Selfdoc, run pip: - pip install flask-autodoc + pip install flask-selfdoc or clone this directory and run setup: @@ -26,15 +26,15 @@ or clone this directory and run setup: ## Usage -Start using Flask-Autodoc by importing it and initializing it: +Start using Flask-Selfdoc by importing it and initializing it: from flask import Flask - from flask.ext.autodoc import Autodoc + from flask.ext.selfdoc import Autodoc app = Flask(__name__) auto = Autodoc(app) -by default, Flask-Autodoc will only document the routes explicitly decorated with _doc_: +by default, Flask-Selfdoc will only document the routes explicitly decorated with _doc_: @app.route('/user/') @auto.doc() From a733eeb3d9617e55c9bddfd1fd89e48c96f47c70 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Tue, 15 May 2018 19:05:42 +0000 Subject: [PATCH 02/46] Change autodoc to selfdoc, in module names and everywhere else. --- MANIFEST.in | 2 +- examples/custom/blog.py | 2 +- examples/factory/blog/doc.py | 2 +- examples/simple/blog.py | 2 +- {flask_autodoc => flask_selfdoc}/__init__.py | 0 {flask_autodoc => flask_selfdoc}/autodoc.py | 0 {flask_autodoc => flask_selfdoc}/templates/autodoc_default.html | 0 tests/test_autodoc.py | 2 +- 8 files changed, 5 insertions(+), 5 deletions(-) rename {flask_autodoc => flask_selfdoc}/__init__.py (100%) rename {flask_autodoc => flask_selfdoc}/autodoc.py (100%) rename {flask_autodoc => flask_selfdoc}/templates/autodoc_default.html (100%) diff --git a/MANIFEST.in b/MANIFEST.in index d03edc7..c2ccd5e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,2 @@ include README.md -include flask_autodoc/templates/autodoc_default.html +include flask_selfdoc/templates/autodoc_default.html diff --git a/examples/custom/blog.py b/examples/custom/blog.py index f32436c..130777c 100644 --- a/examples/custom/blog.py +++ b/examples/custom/blog.py @@ -2,7 +2,7 @@ from json import dumps from flask import Flask, redirect, request -from flask.ext.autodoc import Autodoc +from flask.ext.selfdoc import Autodoc app = Flask(__name__) diff --git a/examples/factory/blog/doc.py b/examples/factory/blog/doc.py index 17307a6..209431b 100644 --- a/examples/factory/blog/doc.py +++ b/examples/factory/blog/doc.py @@ -1,5 +1,5 @@ from flask import Blueprint -from flask.ext.autodoc import Autodoc +from flask.ext.selfdoc import Autodoc doc = Blueprint('doc', __name__, url_prefix='/doc') diff --git a/examples/simple/blog.py b/examples/simple/blog.py index 52ca75c..58262e3 100644 --- a/examples/simple/blog.py +++ b/examples/simple/blog.py @@ -1,7 +1,7 @@ from json import dumps from flask import Flask, redirect, request -from flask.ext.autodoc import Autodoc +from flask.ext.selfdoc import Autodoc app = Flask(__name__) diff --git a/flask_autodoc/__init__.py b/flask_selfdoc/__init__.py similarity index 100% rename from flask_autodoc/__init__.py rename to flask_selfdoc/__init__.py diff --git a/flask_autodoc/autodoc.py b/flask_selfdoc/autodoc.py similarity index 100% rename from flask_autodoc/autodoc.py rename to flask_selfdoc/autodoc.py diff --git a/flask_autodoc/templates/autodoc_default.html b/flask_selfdoc/templates/autodoc_default.html similarity index 100% rename from flask_autodoc/templates/autodoc_default.html rename to flask_selfdoc/templates/autodoc_default.html diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index e839c2f..b94692c 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -5,7 +5,7 @@ import os from flask import Flask -from flask.ext.autodoc import Autodoc +from flask.ext.selfdoc import Autodoc class TestAutodoc(unittest.TestCase): From 67bbbe76769f758ef7fa880a17d67bd9b6b797d5 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Tue, 15 May 2018 19:10:27 +0000 Subject: [PATCH 03/46] Update in one more place. --- flask_selfdoc/__init__.py | 2 +- setup.py | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/flask_selfdoc/__init__.py b/flask_selfdoc/__init__.py index 89e047e..dc7a64c 100644 --- a/flask_selfdoc/__init__.py +++ b/flask_selfdoc/__init__.py @@ -1,3 +1,3 @@ __author__ = 'arnaud' -from flask.ext.autodoc.autodoc import Autodoc +from flask.ext.selfdoc.autodoc import Autodoc diff --git a/setup.py b/setup.py index 066e351..f603f3c 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,8 @@ """ -Flask-Autodoc +Flask-Selfdoc ------------- -Flask autodoc automatically creates an online documentation for your flask app. +Flask selfdoc automatically creates an online documentation for your flask app. """ from setuptools import setup @@ -13,19 +13,18 @@ def readme(): setup( - name='Flask-Autodoc', - version='0.1.2', - url='http://github.com/acoomans/flask-autodoc', + name='Flask-Selfdoc', + version='0.2', + url='http://github.com/jwg4/flask-selfdoc', license='MIT', author='Arnaud Coomans', - author_email='arnaud.coomans@gmail.com', description='Documentation generator for flask', long_description=readme(), # py_modules=['flask_autodoc'], # if you would be using a package instead use packages instead # of py_modules: - packages=['flask_autodoc'], - package_data={'flask_autodoc': ['templates/autodoc_default.html']}, + packages=['flask_selfdoc'], + package_data={'flask_selfdoc': ['templates/autodoc_default.html']}, zip_safe=False, include_package_data=True, platforms='any', From f0477a4fe1634d6d5f4734a092580221ef1a4a4e Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Tue, 15 May 2018 19:41:47 +0000 Subject: [PATCH 04/46] Pin the requirements to an old version of Flask. Flask 1.0 does not support the flask.ext imports that this project currently uses. --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e3e9a71..4a5cb4c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -Flask +Flask==0.12 From 1da61c2cf48f77dab1ecd3ab4a19d6cc081e1bf2 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Tue, 15 May 2018 20:57:59 +0000 Subject: [PATCH 05/46] Remove requirements, specify flask versions in matrix. --- .travis.yml | 7 ++++++- requirements.txt | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) delete mode 100644 requirements.txt diff --git a/.travis.yml b/.travis.yml index eedb46a..8c0eded 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,12 @@ python: - "2.7" - "3.3" - "3.4" + - "3.5" +env: + - FLASK=0.12 + - FLASK=1.0 install: - - pip install -r requirements.txt + - pip install Flask==${FLASK} script: - python -m unittest discover + diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 4a5cb4c..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -Flask==0.12 From b309ea475809d8d99bfc2c00289f32a835266bc8 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Tue, 15 May 2018 21:02:15 +0000 Subject: [PATCH 06/46] Install latest flask but allow to fail. --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8c0eded..17e0137 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,10 @@ python: env: - FLASK=0.12 - FLASK=1.0 + - FLASK=latest +matrix: + allow_failures: + - env: FLASK=latest install: - pip install Flask==${FLASK} script: From 6f0d6dcaa4a8a3d16c0f7dd139825ddac9750ca9 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Tue, 15 May 2018 21:05:52 +0000 Subject: [PATCH 07/46] Specify the actual latest version that we want. (latest doesnt work) --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 17e0137..21756cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,10 @@ python: env: - FLASK=0.12 - FLASK=1.0 - - FLASK=latest + - FLASK=1.0.2 matrix: allow_failures: - - env: FLASK=latest + - env: FLASK=1.0.2 install: - pip install Flask==${FLASK} script: From 6537bcbe487a87e62bde351facb344e4acb82db6 Mon Sep 17 00:00:00 2001 From: jwg4 Date: Wed, 16 May 2018 13:46:25 +0000 Subject: [PATCH 08/46] Replace import. --- flask_selfdoc/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_selfdoc/__init__.py b/flask_selfdoc/__init__.py index dc7a64c..95de98e 100644 --- a/flask_selfdoc/__init__.py +++ b/flask_selfdoc/__init__.py @@ -1,3 +1,3 @@ __author__ = 'arnaud' -from flask.ext.selfdoc.autodoc import Autodoc +from flask_selfdoc.autodoc import Autodoc From a3f14ea633b7d15d5e31a66ef01cf90b9a4ead77 Mon Sep 17 00:00:00 2001 From: jwg4 Date: Wed, 16 May 2018 13:47:28 +0000 Subject: [PATCH 09/46] Change another import. --- tests/test_autodoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index b94692c..69c4553 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -5,7 +5,7 @@ import os from flask import Flask -from flask.ext.selfdoc import Autodoc +from flask_selfdoc import Autodoc class TestAutodoc(unittest.TestCase): From 38e9fd770b2a296c0cabb5f9bab4933ec649f291 Mon Sep 17 00:00:00 2001 From: jwg4 Date: Wed, 16 May 2018 13:48:11 +0000 Subject: [PATCH 10/46] Change another import. --- examples/custom/blog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/custom/blog.py b/examples/custom/blog.py index 130777c..5f4c456 100644 --- a/examples/custom/blog.py +++ b/examples/custom/blog.py @@ -2,7 +2,7 @@ from json import dumps from flask import Flask, redirect, request -from flask.ext.selfdoc import Autodoc +from flask_selfdoc import Autodoc app = Flask(__name__) From a00b16f2944ee23a84748a79ee0f8d198db9f0db Mon Sep 17 00:00:00 2001 From: jwg4 Date: Wed, 16 May 2018 13:48:50 +0000 Subject: [PATCH 11/46] Change another import. --- examples/factory/blog/doc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/factory/blog/doc.py b/examples/factory/blog/doc.py index 209431b..c245eba 100644 --- a/examples/factory/blog/doc.py +++ b/examples/factory/blog/doc.py @@ -1,5 +1,5 @@ from flask import Blueprint -from flask.ext.selfdoc import Autodoc +from flask_selfdoc import Autodoc doc = Blueprint('doc', __name__, url_prefix='/doc') From 8d304e6d27517021f9376fce41f6d6139e84ff3e Mon Sep 17 00:00:00 2001 From: jwg4 Date: Wed, 16 May 2018 13:49:15 +0000 Subject: [PATCH 12/46] Change another import. --- examples/simple/blog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/simple/blog.py b/examples/simple/blog.py index 58262e3..31d2ac8 100644 --- a/examples/simple/blog.py +++ b/examples/simple/blog.py @@ -1,7 +1,7 @@ from json import dumps from flask import Flask, redirect, request -from flask.ext.selfdoc import Autodoc +from flask_selfdoc import Autodoc app = Flask(__name__) From b07dfc8d70184865c8ccc85299ffd3ceaabe5414 Mon Sep 17 00:00:00 2001 From: jwg4 Date: Wed, 16 May 2018 13:59:40 +0000 Subject: [PATCH 13/46] Don't allow failures for latest flask anymore. --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 21756cd..f3b6ee9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,9 +8,6 @@ env: - FLASK=0.12 - FLASK=1.0 - FLASK=1.0.2 -matrix: - allow_failures: - - env: FLASK=1.0.2 install: - pip install Flask==${FLASK} script: From f3635e48304d715eb16604cfca17b6cdc1bd16e1 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Wed, 24 May 2017 20:07:25 +0000 Subject: [PATCH 14/46] Raise an error with a useful message if the app is not setup. --- flask_selfdoc/autodoc.py | 2 ++ setup.py | 2 +- tests/test_error_handling.py | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/test_error_handling.py diff --git a/flask_selfdoc/autodoc.py b/flask_selfdoc/autodoc.py index bb8f23b..f0c424c 100644 --- a/flask_selfdoc/autodoc.py +++ b/flask_selfdoc/autodoc.py @@ -176,6 +176,8 @@ def html(self, groups='all', template=None, **context): By specifying the group or groups arguments, only routes belonging to those groups will be returned. """ + if not self.app: + raise RuntimeError("Autodoc was not initialized with the Flask app.") context['autodoc'] = context['autodoc'] if 'autodoc' in context \ else self.generate(groups=groups) context['defaults'] = context['defaults'] if 'defaults' in context \ diff --git a/setup.py b/setup.py index f603f3c..5abe513 100644 --- a/setup.py +++ b/setup.py @@ -40,5 +40,5 @@ def readme(): 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 'Topic :: Software Development :: Libraries :: Python Modules' ], - test_suite='tests.test_autodoc', + test_suite='tests', ) diff --git a/tests/test_error_handling.py b/tests/test_error_handling.py new file mode 100644 index 0000000..f598c46 --- /dev/null +++ b/tests/test_error_handling.py @@ -0,0 +1,13 @@ +import unittest + +from flask import Flask +from flask_autodoc import Autodoc + + +class TestErrorHandling(unittest.TestCase): + def test_app_not_initialized(self): + app = Flask(__name__) + app.debug = True + autodoc = Autodoc() + with app.app_context(): + self.assertRaises(RuntimeError, lambda: autodoc.html()) From ca087fb71257d60e04125f19a996b41a36a1be87 Mon Sep 17 00:00:00 2001 From: jwg4 Date: Wed, 16 May 2018 14:50:25 +0000 Subject: [PATCH 15/46] Correct name of package. --- tests/test_error_handling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_error_handling.py b/tests/test_error_handling.py index f598c46..cb37698 100644 --- a/tests/test_error_handling.py +++ b/tests/test_error_handling.py @@ -1,7 +1,7 @@ import unittest from flask import Flask -from flask_autodoc import Autodoc +from flask_selfdoc import Autodoc class TestErrorHandling(unittest.TestCase): From 6a6f70d30108e77e1cdb62b33f783d2edf34f296 Mon Sep 17 00:00:00 2001 From: jwg4 Date: Wed, 16 May 2018 22:23:03 +0000 Subject: [PATCH 16/46] Change the import in the example code. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d841a40..4a1219d 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ or clone this directory and run setup: Start using Flask-Selfdoc by importing it and initializing it: from flask import Flask - from flask.ext.selfdoc import Autodoc + from flask_selfdoc import Autodoc app = Flask(__name__) auto = Autodoc(app) @@ -127,4 +127,4 @@ and connect to [/doc/public](http://127.0.0.1:5000/doc/public) and [/doc/private ![screenshots](screenshots/screenshot00.png) -![screenshots](screenshots/screenshot01.png) \ No newline at end of file +![screenshots](screenshots/screenshot01.png) From 92d71046486583ca54f37cf688da9b4f68d4505e Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Wed, 16 May 2018 22:47:35 +0000 Subject: [PATCH 17/46] Do deployment. --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index f3b6ee9..59ef513 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,4 +12,13 @@ install: - pip install Flask==${FLASK} script: - python -m unittest discover +deploy: + provider: pypi + user: "jwg" + password: + secure: JvvqjJoC1Cd3JHPUNBTYJz1UG0irxN4mCSrSLnfFWZX/b8TIkUye3TB4nVITG30PsZtrkdEwTKmrtS/1s2Q3cPPAWN4mayOJFW8M020MvUuBCKe4+j1CceiSdwGqenOVml6kh9fWcCFmeBuJcFBrW4HCYA1quOQ9sEaKAKCOkfpRSAtou5r0QpnoCuzmm837bzfw4kJZybnp0MrLpheQ7xZBqTVegiYkszNJpAm6mCH4Wk1IDUrsqocI2Vwd2kz2gsS+0bA/oC0pVIqs5egjDXet06gAGLmPJnsSjnl5YMQryy33cuMybO8+DsKqTbjFa9WjbPPxq3zfroe26h8YBYFsl7+9LwM88G6C28O5RueHnO9yULpDqR0mLr4ihshj591sdz4eYEc+eih5ofKLTGHHwOw8w/4FcKIJCb6CVTxrNsVW9uqeoNwZyYldrklhtsNxgioMSzGmdb2kprAGrJzARYwUA1mL+51xW7KiebpSSNsN/bYQmgWoURkLaN25+fqbQnMP+QxmIsIOH2374dwoXjTKLhZBW7JZ+B2570SxlBzSx8GkFahz3lMLuUd8Qfpj19FoDkDyDTXCccWnhi8r7NtfQZigWAN4U9yJ/iEegbOomASYtl7O0WZq2wJFeii3KO9fH6p4q3OOz87/yWglWP2+hUL2mlTuw3a74t8= + on: + tags: true + python: 3.5 + env: FLASK=1.0.2 From 25b38921ad774bddb4c47e8b99cadbf346c6f015 Mon Sep 17 00:00:00 2001 From: jwg4 Date: Thu, 17 May 2018 15:38:29 +0000 Subject: [PATCH 18/46] Turn off email notifications. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 59ef513..ba57ae3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,8 @@ install: - pip install Flask==${FLASK} script: - python -m unittest discover +notifications: + email: false deploy: provider: pypi user: "jwg" From 624a94db39316d30da6415f1aa55b58787b7419b Mon Sep 17 00:00:00 2001 From: jwg4 Date: Thu, 17 May 2018 15:57:21 +0000 Subject: [PATCH 19/46] Add flake8 to the script --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index ba57ae3..7c18bab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ install: - pip install Flask==${FLASK} script: - python -m unittest discover + - flake8 notifications: email: false deploy: From 405a892998cf6cd1fe4d9311e1dba4a08eb02d16 Mon Sep 17 00:00:00 2001 From: jwg4 Date: Thu, 17 May 2018 15:59:32 +0000 Subject: [PATCH 20/46] Remove flake8 - keep master build passing. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7c18bab..ba57ae3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,6 @@ install: - pip install Flask==${FLASK} script: - python -m unittest discover - - flake8 notifications: email: false deploy: From bf6d1f5ea3b9d9cf7b2ac713598a83187ddd8c4c Mon Sep 17 00:00:00 2001 From: jwg4 Date: Thu, 17 May 2018 16:00:24 +0000 Subject: [PATCH 21/46] Add flake8 to job. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index ba57ae3..98a6f82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,10 @@ env: - FLASK=1.0.2 install: - pip install Flask==${FLASK} + - pip install flake8 script: - python -m unittest discover + - flake8 notifications: email: false deploy: From 48bf0ef592ff3b077217920abb33f6706384b0d4 Mon Sep 17 00:00:00 2001 From: jwg4 Date: Thu, 17 May 2018 16:05:05 +0000 Subject: [PATCH 22/46] Don't run flake8 on example code. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 98a6f82..53f5250 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ install: - pip install flake8 script: - python -m unittest discover - - flake8 + - flake8 --exclude=examples notifications: email: false deploy: From 91c9f7993c5ea65745c781553a2cfd1ce15942e5 Mon Sep 17 00:00:00 2001 From: jwg4 Date: Thu, 17 May 2018 16:05:56 +0000 Subject: [PATCH 23/46] Ignore the unneeded import error. --- flask_selfdoc/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_selfdoc/__init__.py b/flask_selfdoc/__init__.py index 95de98e..3879f7d 100644 --- a/flask_selfdoc/__init__.py +++ b/flask_selfdoc/__init__.py @@ -1,3 +1,3 @@ __author__ = 'arnaud' -from flask_selfdoc.autodoc import Autodoc +from flask_selfdoc.autodoc import Autodoc # noqa: F401 From 3813c4b9c876e8fcf9ad84dbde71aa9c04ad6f0c Mon Sep 17 00:00:00 2001 From: jwg4 Date: Thu, 17 May 2018 16:12:30 +0000 Subject: [PATCH 24/46] fix/ignore some flake8 stuff --- flask_selfdoc/autodoc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flask_selfdoc/autodoc.py b/flask_selfdoc/autodoc.py index f0c424c..9a64234 100644 --- a/flask_selfdoc/autodoc.py +++ b/flask_selfdoc/autodoc.py @@ -28,7 +28,8 @@ def __init__(self, app=None): self.func_groups = defaultdict(set) self.func_props = defaultdict() self.immutable_props = ['rule', 'endpoint'] - self.default_props = ['methods', 'docstring', + self.default_props = [ + 'methods', 'docstring', 'args', 'defaults', 'location'] + self.immutable_props self.func_locations = defaultdict(dict) if app is not None: @@ -42,7 +43,7 @@ def init_app(self, app): self.add_custom_template_filters(app) def teardown(self, exception): - ctx = stack.top + ctx = stack.top # noqa: F841 def add_custom_template_filters(self, app): """Add custom filters to jinja2 templating engine""" From c2060a1a7389e2c146f8c2c9a07d42bdd838e68f Mon Sep 17 00:00:00 2001 From: jwg4 Date: Thu, 17 May 2018 16:15:24 +0000 Subject: [PATCH 25/46] Add a condition on line length. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 53f5250..bdfedff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ install: - pip install flake8 script: - python -m unittest discover - - flake8 --exclude=examples + - flake8 --exclude=examples --max-line-length=100 notifications: email: false deploy: From 0a256dad4ddeb07a769b1436932e7d894c2ae307 Mon Sep 17 00:00:00 2001 From: jwg4 Date: Thu, 17 May 2018 16:21:05 +0000 Subject: [PATCH 26/46] spacing/other flake8 --- tests/test_autodoc.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index 69c4553..f565062 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -157,13 +157,14 @@ def testCustomParams(self): @self.app.route('/needsargs', methods=['GET']) @self.autodoc.doc('needs_getargs', getargs={ 'a': 'A Value', - 'b': 'B Value' + 'b': 'B Value' }) def getit(): return 'I need specific GET parameters.' @self.app.route('/noargs') - @self.autodoc.doc(groups=['needs_json', 'noargs'], + @self.autodoc.doc( + groups=['needs_json', 'noargs'], expected_type='application/json') def needjson(): return 'I do not need any parameters, but am picky about types.' @@ -259,7 +260,8 @@ def ab(param1, param2): self.assertIn('Returns arguments', doc) def testLocation(self): - line_no = inspect.stack()[0][2] + 2 # the doc() line + line_no = inspect.stack()[0][2] + 2 # the doc() line + @self.app.route('/location') @self.autodoc.doc() def location(): @@ -298,4 +300,3 @@ def redecorate(): self.assertTrue(1 == len(self.autodoc.generate('group1'))) self.assertTrue(1 == len(self.autodoc.generate('group2'))) self.assertFalse(1 == len(self.autodoc.generate('group3'))) - From 1865822e057f0ccd9cd405f45172d1dbe23f0604 Mon Sep 17 00:00:00 2001 From: jwg4 Date: Thu, 17 May 2018 16:32:02 +0000 Subject: [PATCH 27/46] Correct line number for test. --- tests/test_autodoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py index f565062..966c630 100644 --- a/tests/test_autodoc.py +++ b/tests/test_autodoc.py @@ -260,7 +260,7 @@ def ab(param1, param2): self.assertIn('Returns arguments', doc) def testLocation(self): - line_no = inspect.stack()[0][2] + 2 # the doc() line + line_no = inspect.stack()[0][2] + 3 # the doc() line @self.app.route('/location') @self.autodoc.doc() From fa744d715ecbf3923267f84f87ac957b5b9627ad Mon Sep 17 00:00:00 2001 From: jwg4 Date: Thu, 17 May 2018 17:28:56 +0000 Subject: [PATCH 28/46] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4a1219d..9646f2a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Flask-Selfdoc Flask-Selfdoc is a Flask extension that automatically creates documentation for your endpoints based on the routes, function arguments and docstrings. It was forked from Flask-Autodoc, written by Arnaud Coomans, and is completely compatible as a replacement for that extension. [![Build](https://api.travis-ci.org/jwg4/flask-autodoc.png)](https://travis-ci.org/jwg4/flask-autodoc) -[![Pypi version](http://img.shields.io/pypi/v/flask-autodoc.svg)](https://pypi.python.org/pypi/Flask-Selfdoc) +[![Pypi version](http://img.shields.io/pypi/v/flask-selfdoc.svg)](https://pypi.python.org/pypi/Flask-Selfdoc) [![Pypi license](http://img.shields.io/pypi/l/flask-selfdoc.svg)](https://pypi.python.org/pypi/Flask-Selfdoc) ![Python 2](http://img.shields.io/badge/python-2-blue.svg) ![Python 3](http://img.shields.io/badge/python-3-blue.svg) From f6c1e512f20555fb96a55b93ebc4fe9b787181f3 Mon Sep 17 00:00:00 2001 From: jwg4 Date: Fri, 18 May 2018 06:38:16 +0000 Subject: [PATCH 29/46] Change name of travis task in README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9646f2a..b43ebb8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Flask-Selfdoc Flask-Selfdoc is a Flask extension that automatically creates documentation for your endpoints based on the routes, function arguments and docstrings. It was forked from Flask-Autodoc, written by Arnaud Coomans, and is completely compatible as a replacement for that extension. -[![Build](https://api.travis-ci.org/jwg4/flask-autodoc.png)](https://travis-ci.org/jwg4/flask-autodoc) +[![Build](https://api.travis-ci.org/jwg4/flask-selfdoc.png)](https://travis-ci.org/jwg4/flask-selfdoc) [![Pypi version](http://img.shields.io/pypi/v/flask-selfdoc.svg)](https://pypi.python.org/pypi/Flask-Selfdoc) [![Pypi license](http://img.shields.io/pypi/l/flask-selfdoc.svg)](https://pypi.python.org/pypi/Flask-Selfdoc) ![Python 2](http://img.shields.io/badge/python-2-blue.svg) From aedc99cfe4267f6503f190e1ee34cfc25e97d61d Mon Sep 17 00:00:00 2001 From: jwg4 Date: Fri, 18 May 2018 06:53:32 +0000 Subject: [PATCH 30/46] Add maintainer details. --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index 5abe513..ba6f64d 100644 --- a/setup.py +++ b/setup.py @@ -18,6 +18,8 @@ def readme(): url='http://github.com/jwg4/flask-selfdoc', license='MIT', author='Arnaud Coomans', + maintainer='Jack Grahl', + maintainer_email='jack.grahl@gmail.com', description='Documentation generator for flask', long_description=readme(), # py_modules=['flask_autodoc'], From 0c9daff813d81e712b92fb78a02ef8bc17cdfdc3 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Wed, 16 May 2018 22:52:53 +0000 Subject: [PATCH 31/46] Add a prerelease version number. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ba6f64d..7670e28 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def readme(): setup( name='Flask-Selfdoc', - version='0.2', + version='1.0a1', url='http://github.com/jwg4/flask-selfdoc', license='MIT', author='Arnaud Coomans', From 405b04e08a6f43cf8272836ebb27bb4512e7749d Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Wed, 16 May 2018 23:08:53 +0000 Subject: [PATCH 32/46] Bump the prerelease version. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7670e28..f2e2e3a 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def readme(): setup( name='Flask-Selfdoc', - version='1.0a1', + version='1.0a2', url='http://github.com/jwg4/flask-selfdoc', license='MIT', author='Arnaud Coomans', From f7c452b5c6648fa4717efc2cb5b2e5b2d4c9509c Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Sat, 19 May 2018 20:08:49 +0000 Subject: [PATCH 33/46] Bump version to 1.0. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f2e2e3a..e0dd221 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def readme(): setup( name='Flask-Selfdoc', - version='1.0a2', + version='1.0', url='http://github.com/jwg4/flask-selfdoc', license='MIT', author='Arnaud Coomans', From f7f3fae796fd0ecfd1c1a55c137da377497a69a1 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Sat, 19 May 2018 20:31:59 +0000 Subject: [PATCH 34/46] Add the new pypi.org server to the travis deployment config. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index bdfedff..6fb5068 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ deploy: user: "jwg" password: secure: JvvqjJoC1Cd3JHPUNBTYJz1UG0irxN4mCSrSLnfFWZX/b8TIkUye3TB4nVITG30PsZtrkdEwTKmrtS/1s2Q3cPPAWN4mayOJFW8M020MvUuBCKe4+j1CceiSdwGqenOVml6kh9fWcCFmeBuJcFBrW4HCYA1quOQ9sEaKAKCOkfpRSAtou5r0QpnoCuzmm837bzfw4kJZybnp0MrLpheQ7xZBqTVegiYkszNJpAm6mCH4Wk1IDUrsqocI2Vwd2kz2gsS+0bA/oC0pVIqs5egjDXet06gAGLmPJnsSjnl5YMQryy33cuMybO8+DsKqTbjFa9WjbPPxq3zfroe26h8YBYFsl7+9LwM88G6C28O5RueHnO9yULpDqR0mLr4ihshj591sdz4eYEc+eih5ofKLTGHHwOw8w/4FcKIJCb6CVTxrNsVW9uqeoNwZyYldrklhtsNxgioMSzGmdb2kprAGrJzARYwUA1mL+51xW7KiebpSSNsN/bYQmgWoURkLaN25+fqbQnMP+QxmIsIOH2374dwoXjTKLhZBW7JZ+B2570SxlBzSx8GkFahz3lMLuUd8Qfpj19FoDkDyDTXCccWnhi8r7NtfQZigWAN4U9yJ/iEegbOomASYtl7O0WZq2wJFeii3KO9fH6p4q3OOz87/yWglWP2+hUL2mlTuw3a74t8= + server: https://upload.pypi.org/legacy/ on: tags: true python: 3.5 From 2102a955dd5bdceca00a087e1613e2974b54cf8e Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Sat, 19 May 2018 20:37:33 +0000 Subject: [PATCH 35/46] Make this the first release candidate. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e0dd221..93d8c54 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def readme(): setup( name='Flask-Selfdoc', - version='1.0', + version='1.0rc1', url='http://github.com/jwg4/flask-selfdoc', license='MIT', author='Arnaud Coomans', From aeefbc794f2caa09a7f57540cfd0db5e095d9974 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Sat, 19 May 2018 20:42:06 +0000 Subject: [PATCH 36/46] Version 1.0.1. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 93d8c54..6a04c5c 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def readme(): setup( name='Flask-Selfdoc', - version='1.0rc1', + version='1.0.1', url='http://github.com/jwg4/flask-selfdoc', license='MIT', author='Arnaud Coomans', From 0e797d3b15c28b1e36259db19292efb488eabdc9 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Sat, 19 May 2018 20:47:29 +0000 Subject: [PATCH 37/46] Remove auto-deploy code. --- .travis.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6fb5068..519b0f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,14 +16,4 @@ script: - flake8 --exclude=examples --max-line-length=100 notifications: email: false -deploy: - provider: pypi - user: "jwg" - password: - secure: JvvqjJoC1Cd3JHPUNBTYJz1UG0irxN4mCSrSLnfFWZX/b8TIkUye3TB4nVITG30PsZtrkdEwTKmrtS/1s2Q3cPPAWN4mayOJFW8M020MvUuBCKe4+j1CceiSdwGqenOVml6kh9fWcCFmeBuJcFBrW4HCYA1quOQ9sEaKAKCOkfpRSAtou5r0QpnoCuzmm837bzfw4kJZybnp0MrLpheQ7xZBqTVegiYkszNJpAm6mCH4Wk1IDUrsqocI2Vwd2kz2gsS+0bA/oC0pVIqs5egjDXet06gAGLmPJnsSjnl5YMQryy33cuMybO8+DsKqTbjFa9WjbPPxq3zfroe26h8YBYFsl7+9LwM88G6C28O5RueHnO9yULpDqR0mLr4ihshj591sdz4eYEc+eih5ofKLTGHHwOw8w/4FcKIJCb6CVTxrNsVW9uqeoNwZyYldrklhtsNxgioMSzGmdb2kprAGrJzARYwUA1mL+51xW7KiebpSSNsN/bYQmgWoURkLaN25+fqbQnMP+QxmIsIOH2374dwoXjTKLhZBW7JZ+B2570SxlBzSx8GkFahz3lMLuUd8Qfpj19FoDkDyDTXCccWnhi8r7NtfQZigWAN4U9yJ/iEegbOomASYtl7O0WZq2wJFeii3KO9fH6p4q3OOz87/yWglWP2+hUL2mlTuw3a74t8= - server: https://upload.pypi.org/legacy/ - on: - tags: true - python: 3.5 - env: FLASK=1.0.2 From e6631dfb2d22e555b74e7302a3b6a7c39f1f053e Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Sat, 19 May 2018 20:54:00 +0000 Subject: [PATCH 38/46] Version 1.0.2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6a04c5c..dba1f9a 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def readme(): setup( name='Flask-Selfdoc', - version='1.0.1', + version='1.0.2', url='http://github.com/jwg4/flask-selfdoc', license='MIT', author='Arnaud Coomans', From 9fbf6dfd12aa96b554578173fc969081a18c92d9 Mon Sep 17 00:00:00 2001 From: jwg4 Date: Sun, 21 May 2017 08:31:27 +0000 Subject: [PATCH 39/46] Stub for json method. --- flask_selfdoc/autodoc.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/flask_selfdoc/autodoc.py b/flask_selfdoc/autodoc.py index 9a64234..1e6b960 100644 --- a/flask_selfdoc/autodoc.py +++ b/flask_selfdoc/autodoc.py @@ -5,7 +5,7 @@ import sys import inspect -from flask import current_app, render_template, render_template_string +from flask import current_app, render_template, render_template_string, jsonify from jinja2 import evalcontextfilter @@ -195,3 +195,13 @@ def html(self, groups='all', template=None, **context): content = file.read() with current_app.app_context(): return render_template_string(content, **context) + + def json(self, groups='all', **context): + """Return a json object with documentation for all the routes specified + by the doc() method. + + By specifiying the groups argument, only routes belonging to those groups + will be returned. + """ + data = {} + return jsonify(data) From 0bf2d9a440745e3a193ae1c0921fb3d6ffba4d24 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Sun, 21 May 2017 08:51:50 +0000 Subject: [PATCH 40/46] Add a test for HTML retrieval. --- tests/test_flask_get.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/test_flask_get.py diff --git a/tests/test_flask_get.py b/tests/test_flask_get.py new file mode 100644 index 0000000..a7334df --- /dev/null +++ b/tests/test_flask_get.py @@ -0,0 +1,26 @@ +import unittest + +from flask import Flask +from flask.ext.autodoc import Autodoc + + +class TestAutodocWithFlask(unittest.TestCase): + def setUp(self): + self.app = Flask(__name__) + self.autodoc = Autodoc(self.app) + + @self.app.route('/') + @self.autodoc.doc() + def index(): + """Returns a hello world message""" + return 'Hello World!' + + self.client = self.app.test_client() + + def test_html(self): + @self.app.route('/docs') + def html_docs(): + return self.autodoc.html() + + response = self.client.get('/docs') + self.assertEqual(response.status_code, 200) From 5de17d8c65f88107aeda059a84a6b19954364e14 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Sun, 21 May 2017 08:54:09 +0000 Subject: [PATCH 41/46] Add a test for json retrieval. --- tests/test_flask_get.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_flask_get.py b/tests/test_flask_get.py index a7334df..d2e2373 100644 --- a/tests/test_flask_get.py +++ b/tests/test_flask_get.py @@ -24,3 +24,11 @@ def html_docs(): response = self.client.get('/docs') self.assertEqual(response.status_code, 200) + + def test_json(self): + @self.app.route('/docs') + def json_docs(): + return self.autodoc.json() + + response = self.client.get('/docs') + self.assertEqual(response.status_code, 200) From 7b9ef7ff50dd982926a70d34aa9b0d3f29dab887 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Sun, 21 May 2017 08:56:59 +0000 Subject: [PATCH 42/46] Make this test a bit harder. --- tests/test_flask_get.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_flask_get.py b/tests/test_flask_get.py index d2e2373..1373ca1 100644 --- a/tests/test_flask_get.py +++ b/tests/test_flask_get.py @@ -1,3 +1,4 @@ +import json import unittest from flask import Flask @@ -32,3 +33,6 @@ def json_docs(): response = self.client.get('/docs') self.assertEqual(response.status_code, 200) + + data = json.loads(response.data) + self.assertIn('endpoints', data) From 4aa29753411a12c57736d852ac1e7dcdcdc24ef9 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Wed, 24 May 2017 20:19:52 +0000 Subject: [PATCH 43/46] Add something for each documented endpoint. --- flask_selfdoc/autodoc.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/flask_selfdoc/autodoc.py b/flask_selfdoc/autodoc.py index 1e6b960..9309cfe 100644 --- a/flask_selfdoc/autodoc.py +++ b/flask_selfdoc/autodoc.py @@ -196,12 +196,16 @@ def html(self, groups='all', template=None, **context): with current_app.app_context(): return render_template_string(content, **context) - def json(self, groups='all', **context): + def json(self, groups='all'): """Return a json object with documentation for all the routes specified by the doc() method. By specifiying the groups argument, only routes belonging to those groups will be returned. """ - data = {} + autodoc = self.generate(groups=groups) + data = { + 'endpoints': + [ "doc" for doc in autodoc ] + } return jsonify(data) From 04076533cdb8592b2cb64e54810e095486d76475 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Wed, 24 May 2017 21:03:50 +0000 Subject: [PATCH 44/46] Send back some actual info about the endpoint. This is roughly the same as what is available in the HTML template. --- flask_selfdoc/autodoc.py | 15 +++++++++++++-- tests/test_flask_get.py | 10 ++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/flask_selfdoc/autodoc.py b/flask_selfdoc/autodoc.py index 9309cfe..4367d88 100644 --- a/flask_selfdoc/autodoc.py +++ b/flask_selfdoc/autodoc.py @@ -199,13 +199,24 @@ def html(self, groups='all', template=None, **context): def json(self, groups='all'): """Return a json object with documentation for all the routes specified by the doc() method. - + By specifiying the groups argument, only routes belonging to those groups will be returned. """ autodoc = self.generate(groups=groups) + + def endpoint_info(doc): + args = doc['args'] + if args == ['None']: + args = [] + return { + "args": [(arg, doc['defaults'][arg]) for arg in args], + "docstring": doc['docstring'], + "methods": sorted(list(doc['methods'])), + "rule": doc['rule'] + } data = { 'endpoints': - [ "doc" for doc in autodoc ] + [endpoint_info(doc) for doc in autodoc] } return jsonify(data) diff --git a/tests/test_flask_get.py b/tests/test_flask_get.py index 1373ca1..8904587 100644 --- a/tests/test_flask_get.py +++ b/tests/test_flask_get.py @@ -36,3 +36,13 @@ def json_docs(): data = json.loads(response.data) self.assertIn('endpoints', data) + self.assertEqual(len(data['endpoints']), 1) + + endpoint = data['endpoints'][0] + expected = { + "args": [], + "docstring": "Returns a hello world message", + "methods": ["GET", "HEAD", "OPTIONS"], + "rule": "/" + } + self.assertEqual(endpoint, expected) From eeed4ce722057110f78c1df99c59fe12cfa98935 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Thu, 25 May 2017 23:46:00 +0000 Subject: [PATCH 45/46] Decode bytes from HTTP into a string. --- tests/test_flask_get.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_flask_get.py b/tests/test_flask_get.py index 8904587..764c561 100644 --- a/tests/test_flask_get.py +++ b/tests/test_flask_get.py @@ -34,7 +34,7 @@ def json_docs(): response = self.client.get('/docs') self.assertEqual(response.status_code, 200) - data = json.loads(response.data) + data = json.loads(response.data.decode('utf-8')) self.assertIn('endpoints', data) self.assertEqual(len(data['endpoints']), 1) From 5b0661fb60afd09b0c7a5a3bc31c5c3bb7f37cd9 Mon Sep 17 00:00:00 2001 From: Jack Grahl Date: Sat, 19 May 2018 21:06:28 +0000 Subject: [PATCH 46/46] Correct import. --- .vscode/settings.json | 3 +++ tests/test_flask_get.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1337f53 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "${workspaceFolder}\\venv\\Scripts\\python.exe" +} \ No newline at end of file diff --git a/tests/test_flask_get.py b/tests/test_flask_get.py index 764c561..42c59da 100644 --- a/tests/test_flask_get.py +++ b/tests/test_flask_get.py @@ -2,7 +2,7 @@ import unittest from flask import Flask -from flask.ext.autodoc import Autodoc +from flask_selfdoc import Autodoc class TestAutodocWithFlask(unittest.TestCase):