Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add /version endpoint and __version__ #14

Merged
merged 1 commit into from
Nov 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions slack_overflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from slack_overflow.html2slack import html2slack


__version__ = "0.1.0"

app = Flask(__name__)


Expand Down Expand Up @@ -110,6 +112,11 @@ def hello():
return redirect('https://github.com/hfaran/slack-overflow')


@app.route('/version')
def version():
return flask.jsonify(**{"version": __version__})


###########
# Helpers #
###########
Expand Down
6 changes: 6 additions & 0 deletions tests/test_slack_overflow.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import unittest

import flask
Expand Down Expand Up @@ -71,3 +72,8 @@ def test__root(self):
rv = self.app.get('/')
print(rv.data)
assert all(term in rv.data for term in ("Redirecting", "github"))

def test__version(self):
rv = self.app.get('/version')
print(rv.data)
assert json.loads(rv.data)["version"] == slack_overflow.__version__