Esempio n. 1
0
from mf_app import db
from mf_app.models import User

db.create_all()

#test input data
admin = User('admin', '*****@*****.**', 'admin')
guest = User('guest', '*****@*****.**', 'guest')

db.session.add(admin)
db.session.add(guest)

db.session.commit()

users = User.query.all()
print(users)
Esempio n. 2
0
from mf_app import db
from mf_app.models import User, Comment, Event, Article, Source


db.drop_all()
db.create_all() #is this necessary to insert mock data?

#TEST USER DATA
#def __init__(self, username=None, email=None, password=None, creation_date=None, updated_date=None, lost_password_key=None):
#dates set to datetime.datetime.utcnow()
admin = User('admin', '*****@*****.**', 'admin1', 'fakelostpasskey1')
guest = User('guest', '*****@*****.**', 'guest1', 'fakelostpasskey1')

#TEST COMMENT DATA
#def __init__(self, comment=None, comment_date=None, comment_update=None):
#dates set to datetime.datetime.utcnow()
comment1 = Comment("this is not a substantive comment")

#TEST EVENT DATA
#def __init__(self, event_title=None, user_id=None, event_date=None, event_update=None):
#dates set to datetime.datetime.utcnow()
event1 = Event('SF Housing', 2)

#TEST ARTICLE DATA
#def __init__(self, article_title=None, url=None, cleaned_text=None, word_freq_dict=None)
article1 = Article("Dog eats Grandmother", "www.realnews.com", "cleaned text, this could get really long and punc could matter in the db", "word freq dictionary I guess")

#TEST SOURCE DATA
#def __init__(self, source_name=None, source_base_url=None):
source1 = Source('NYTimes', 'www.nytimes.com')
Esempio n. 3
0
	def setUp(self):
		app.config['TESTING'] = True
		app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, TEST_DB)
		self.app = app.test_client()
		db.create_all()