Skip to content
Permalink
Browse files
small changes
  • Loading branch information
Michelle Beard committed Apr 11, 2016
1 parent 231771d commit 0405f1445cbd8c604471f3617d501dd84f4a850e
Showing 3 changed files with 54 additions and 5 deletions.
@@ -1,29 +1,46 @@
from flask import Flask, request, session, g, redirect, url_for, \
abort, render_template, flash

from userale import Ale
# from userale import Ale

# configuration
# configuration - needs to be in a seperate file
ES = 'http://localhost:9200'
DEBUG = True
USERNAME = 'admin'
PASSWORD = 'default'

app = Flask(__name__)

"""
Show Distill version information, connection status (USERALE), etc.
"""
@app.route ('/')
def index ():
return 'Index Page'

@app.route ('/app/<app_id>', methods=['POST'])
def create (app_id):
"""
curl -XPOST https://[hostname]/app -d
{
"app_name" : "application_name",
"description" : "the description of the application",
"version" : 1.0
}
Creates an index in Elasticsearch to store user logs to
"""
@app.route ('/app/register', methods=['POST'])
def create ():
print request.form
return 'Registering application called %s ' % app_id

"""
curl -XGET http://localhost:5000/app/xdata_test -d '{ "version" : 1.0 }
"""
@app.route ('/app/<app_id>', methods=['GET'])
def read (app_id):
return 'Returning application information stored in Elasticsearch for %s ' % app_id

@app.route ('/app/<app_id>', methods=['POST'])
@app.route ('/app/<app_id>', methods=['PUT'])
def update (app_id):
return "Updating application %s " % app_id

@@ -0,0 +1,28 @@
from flask import Flask

app = flask.Flask (__name__)

def test_example ():
with app.test_client () as c:
rv = c.get ('/?tequila=42')
assert request.args ['tequila'] == '42'

import os
import flaskr
import unittest
import tempfile

class FlaskrTestCase(unittest.TestCase):

def setUp(self):
self.db_fd, flaskr.app.config['DATABASE'] = tempfile.mkstemp()
flaskr.app.config['TESTING'] = True
self.app = flaskr.app.test_client()
flaskr.init_db()

def tearDown(self):
os.close(self.db_fd)
os.unlink(flaskr.app.config['DATABASE'])

if __name__ == '__main__':
unittest.main()
@@ -17,6 +17,10 @@

here = os.path.abspath(os.path.dirname(__file__))

if sys.argv[-1] == 'setup.py':
print("To install, run 'python setup.py install'")
print()

def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')

0 comments on commit 0405f14

Please sign in to comment.