Skip to content

Commit

Permalink
Merge pull request #14 from hfaran/hfaran_version
Browse files Browse the repository at this point in the history
Add /version endpoint and __version__
  • Loading branch information
hfaran committed Nov 28, 2015
2 parents 60c6124 + 1d7547a commit 4754e0c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
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__

0 comments on commit 4754e0c

Please sign in to comment.