#!.env/bin/python
import os

os.environ['FLASK_ENV'] = 'test'

import app
import unittest
import tempfile
#### REMOVE THIS AND ITS EVIL KIN import testing.cassandra
import uuid
import base64
from migrator import Migrator
from werkzeug.datastructures import Headers
from werkzeug.test import Client
from flask import json, jsonify

class FlaskrTestCase(unittest.TestCase):
  @classmethod
  def setUpClass(cls):
    app.env.from_object('config')
    cls.migrator = Migrator(app.app.config)
    cls.migrator.create_keyspace()
    cls.app = app.app.test_client()

  def setUp(self):
    self.migrator.create_tables()
    basic = ('Basic %s' % base64.b64encode('admin:testing'))
    self.headers = dict(Authorization = basic)

  @classmethod
  def tearDownClass(cls):
    cls.migrator.destroy_all_the_things()

  def tearDown(self):
    self.migrator.destroy_the_tables()

  def test_404(self):
    rv = self.app.get('/api/not/here')
    assert 404 == rv.status_code

  def test_unauthorized(self):
    rv = self.app.get('/api/v1.0/status')
    assert 403 == rv.status_code
    assert 'Unauthorized access' in rv.data

  def test_empty_db(self):
    rv = self.app.open('/api/v1.0/status', headers = self.headers)
    data = json.loads(rv.data)
    assert [] == data['status']

if __name__ == '__main__':
  unittest.main()

@@ -690,13 +690,11 @@
 s = 
-dict(
+%5B('
 Auth
@@ -706,17 +706,56 @@
 tion
- =
+',
  basic)
+, ('Content-Type', 'application/json')%5D
 %0A%0A  
@@ -967,21 +967,29 @@
     
+self.
 assert
- 404 ==
+Equal(404,
  rv.
@@ -999,16 +999,17 @@
 tus_code
+)
 %0A%0A  def 
@@ -1083,21 +1083,29 @@
     
+self.
 assert
- 403 ==
+Equal(403,
  rv.
@@ -1115,16 +1115,17 @@
 tus_code
+)
 %0A    ass
@@ -1211,12 +1211,11 @@
 app.
-open
+get
 ('/a
@@ -1319,16 +1319,433 @@
 atus'%5D%0A%0A
+  def test_post_stat(self):%0A    json_data = %7B'site': 'local', 'service': 'testing', 'message':'nominal', 'state':1%7D%0A    json_string = json.dumps(json_data)%0A%0A    h = self.headers + %5B('Content-Length', len(json_string))%5D%0A    rv = self.app.post('/api/v1.0/status', data = json_string, headers = h)%0A    self.assertEqual(201, rv.status_code)%0A    data = json.loads(rv.data)%0A    self.assertEqual('success', data%5B'status'%5D)%0A%0A
 if __nam

Add post stat test