From 071bef53a29b120213d58d1a9058ec7027cd17a3 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Sun, 16 Mar 2014 16:34:12 -0300 Subject: [PATCH] in memory tests --- luncho/server.py | 10 +++++++--- tests/users_tests.py | 9 +++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/luncho/server.py b/luncho/server.py index 9e461f3..20147dd 100644 --- a/luncho/server.py +++ b/luncho/server.py @@ -32,16 +32,20 @@ db = SQLAlchemy(app) class User(db.Model): username = db.Column(db.String, primary_key=True) - full_name = db.Column(db.String, nullable=False) + fullname = db.Column(db.String, nullable=False) passhash = db.Column(db.String, nullable=False) token = db.Column(db.String) issued_date = db.Column(db.Date) validated = db.Column(db.Boolean, default=False) - def __init__(self, username, full_name, passhash): + def __init__(self, username, fullname, passhash, token=None, + issued_date=None, validated=False): self.username = username - self.full_name = full_name + self.fullname = fullname self.passhash = passhash + self.token = token + self.issued_date = issued_date + self.validated = validated # ---------------------------------------------------------------------- # Blueprints diff --git a/tests/users_tests.py b/tests/users_tests.py index 68795ca..8e5280a 100644 --- a/tests/users_tests.py +++ b/tests/users_tests.py @@ -1,8 +1,6 @@ #!/usr/bin/env python # -*- encoding: utf-8 -*- -import os -import tempfile import unittest import json @@ -13,12 +11,11 @@ class TestUsers(unittest.TestCase): """Test users request.""" def setUp(self): - (_, name) = tempfile.mkstemp() - - server.app.config['SQLITE_FILENAME'] = name + # leave the database blank to make it in memory + server.app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://' server.app.config['TESTING'] = True - print server.app.config['SQLITE_FILENAME'] + print server.app.config['SQLALCHEMY_DATABASE_URI'] self.app = server.app.test_client() # def tearDown(self):