Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Fractalis
fractalis
Commits
4e71e7c3
Commit
4e71e7c3
authored
Nov 23, 2017
by
Sascha Herzinger
Browse files
added new api call to check for backend version
parent
c6272a2a
Pipeline
#2663
passed with stage
in 9 minutes and 8 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
fractalis/__init__.py
View file @
4e71e7c3
...
...
@@ -60,11 +60,13 @@ from fractalis.celeryapp import make_celery, register_tasks # noqa
celery
=
make_celery
(
app
)
# register blueprints
from
fractalis.analytics.controller
import
analytics_blueprint
# noqa
from
fractalis.data.controller
import
data_blueprint
# noqa
from
fractalis.analytics.controller
import
analytics_blueprint
# noqa: E402
from
fractalis.data.controller
import
data_blueprint
# noqa: E402
from
fractalis.misc.controller
import
misc_blueprint
# noqa: E402
log
.
info
(
"Registering Flask blueprints."
)
app
.
register_blueprint
(
analytics_blueprint
,
url_prefix
=
'/analytics'
)
app
.
register_blueprint
(
data_blueprint
,
url_prefix
=
'/data'
)
app
.
register_blueprint
(
misc_blueprint
,
url_prefix
=
'/misc'
)
# registering all application celery tasks
log
.
info
(
"Registering celery tasks."
)
...
...
fractalis/misc/__init__.py
0 → 100644
View file @
4e71e7c3
fractalis/misc/controller.py
0 → 100644
View file @
4e71e7c3
"""The /misc controller provides an API for everything that does not belong
in any of the other categories."""
import
logging
import
pkg_resources
from
typing
import
Tuple
from
flask
import
Blueprint
,
jsonify
,
Response
misc_blueprint
=
Blueprint
(
'misc_blueprint'
,
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
@
misc_blueprint
.
route
(
'/version'
,
methods
=
[
'GET'
])
def
get_version
()
->
Tuple
[
Response
,
int
]:
version
=
pkg_resources
.
require
(
'fractalis'
)[
0
].
version
return
jsonify
({
'version'
:
version
}),
201
tests/functional/test_misc.py
0 → 100644
View file @
4e71e7c3
"""This module provides tests for the misc controller."""
import
re
import
flask
import
pytest
class
TestMisc
:
@
pytest
.
fixture
(
scope
=
'function'
)
def
test_client
(
self
):
from
fractalis
import
app
app
.
testing
=
True
with
app
.
test_client
()
as
test_client
:
yield
test_client
def
test_get_version_returns_version
(
self
,
test_client
):
rv
=
test_client
.
get
(
'/misc/version'
)
body
=
flask
.
json
.
loads
(
rv
.
get_data
())
assert
re
.
match
(
'^\d+.\d+.\d+$'
,
body
[
'version'
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment