from flask_testing import TestCase
import nose
from application import app, db
import config
from application.models import User, Bucketlist


class BaseTest(TestCase):
    def create_app(self):
        app.config.from_object(config.environment_configuration['testing'])
        return app

    def setUp(self):
        """ create test database and client """
        self.client = app.test_client()
        SECRET_KEY = app.config.get("SECRET_KEY")
        db.create_all()

        default_user = User(username="default_user", email="Default@example.com")
        default_user.set_password(password="password")

        # add test bucketlists
        bucketlist1 = Bucketlist(name="Trip to Mombasa", created_by=default_user.username, author=default_user)
        bucketlist2 = Bucketlist(name="Charity Drive", created_by=default_user.username, author=default_user)


        db.session.add(default_user)
        db.session.add(bucketlist1)
        db.session.add(bucketlist2)
        db.session.commit()

    def tearDown(self):
        db.drop_all()


if __name__ == "__main__":
    nose.run()

@@ -134,16 +134,46 @@
 ketlist%0A
+from datetime import datetime%0A
 %0A%0Aclass 
@@ -723,16 +723,48 @@
 ombasa%22,
+ date_created=datetime.utcnow(),
  created
@@ -865,16 +865,48 @@
  Drive%22,
+ date_created=datetime.utcnow(),
  created
@@ -954,17 +954,16 @@
 _user)%0A%0A
-%0A
         

add manual bucketlists