def setUp(self): db.create_all() db.session.add(User("admin", "*****@*****.**", "admin")) db.session.add(BlogPost("Test post", "This is a test. Only a test.", "admin")) db.session.commit()
def setUp(self): app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + \ os.path.join(basedir, TEST_DB) self.app = app.test_client() db.create_all()
def setUp(self): app.config['TESTING'] = True app.config['CSRF_ENABLED'] = False #app.config['SECRET_KEY'] = 'my_precious' app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db' self.app = app.test_client() db.create_all()
def setUp(self): meta = MetaData(db.engine) meta.reflect() meta.drop_all() db.create_all() db.session.add(User("admin", "*****@*****.**", "admin", "admin")) db.session.commit()
def setUp(self): app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['DEBUG'] = False app.config['SQLALCHEMY_DATABASE_PATH'] = 'sqlite:///' + os.path.join(basedir, TEST_DB) self.app = app.test_client() db.create_all() self.assertEquals(app.debug, False)
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() self.assertEquals(app.debug, False)
def setUp(self): # self.tester = app.test_client(self) self.good_cred = dict(username='******', password='******') self.bad_cred = dict(username='******', password='******') db.create_all() db.session.add(BlogPost('Test post', 'This is a test. Only a test.', 1)) db.session.add(User('admin', '*****@*****.**', 'admin')) db.session.commit()
def setUp(self): # executes prior to each test app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + TEST_DB app.config['DEBUG'] = False self.app = app.test_client() db.create_all()
def setUp(self): app.config["TESTING"] = True app.config["WTF_CSRF_ENABLED"] = False app.config["DEBUG"] = False app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + os.path.join(basedir, TEST_DB) self.app = app.test_client() db.create_all() self.assertEquals(app.debug, False)
def setUpClass(self): db.create_all() user = User( email="*****@*****.**", password="******", confirmed=False ) db.session.add(user) db.session.commit()
def setUp(self): # create all the database tables before each test db.drop_all() db.create_all() db.session.add(User("admin", "password")) db.session.add(Feature("layered rocks", "rock123.jpg", "layered_rocks")) db.session.add(Feature("blueberries", "blueberries123.jpg", "blueberries")) db.session.add(Photo("mars.jpg", "mars1234", datetime.datetime.now())) db.session.commit()
def setUp(self): app.config.from_object('config.TestConfig') self.client = app.test_client() db.create_all() user = User("admin", "*****@*****.**", "admin") db.session.add(user) db.session.add( BlogPosts("Test post", "This is a test. Only a test.", user.id)) db.session.commit()
def setUp(self): """ Executing prior to each tasks. Create environnement where tests while be executing. """ app.config.from_object('project._config.TestConfig') self.app = app.test_client() db.create_all() self.assertEquals(app.debug, False)
def setUp(self): """Executed prior to each test.""" app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['DEBUG'] = False app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + \ os.path.join(basedir, TEST_DB) self.app = app.test_client() db.create_all() self.assertEquals(app.debug, False)
def setUp(self): """ Executing prior to each tasks. Create environnement where tests while be executing. """ app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + \ os.path.join(basedir, TEST_DB) self.app = app.test_client() db.create_all()
def seed(): db.drop_all() db.create_all() sample = DDL("sample", ",", "\\n") if not DDL.query.filter_by(title="sample").first(): db.session.add(sample) sample = DDL.query.filter_by(title="sample").first() attributes = [] attr = Attribute("order_num", "integer", False, None) attributes.append(attr) attr = Attribute("id", "string", False, None) attributes.append(attr) attr = Attribute("post_code", "string", False, None) attributes.append(attr) attr = Attribute("age", "integer", False, None) attributes.append(attr) attr = Attribute("ip", "string", False, None) attributes.append(attr) attr = Attribute("buy_date", "string", False, None) attributes.append(attr) attr = Attribute("total_price", "integer", False, None) attributes.append(attr) attr = Attribute("itemcode", "integer", False, None) attributes.append(attr) attr = Attribute("buy_good_count", "integer", False, None) attributes.append(attr) attr = Attribute("buy_good_price", "integer", False, None) attributes.append(attr) attr = Attribute("good_cate", "string", False, None) attributes.append(attr) for a in attributes: a.ddl_id = sample.id db.session.add(a) #preprocessed = DDL("preprocessed", "") db.session.commit()
def db(app, request): """session wide test database""" def teardown(): _db.session.remove() _db.drop_all() _db.app = app _db.create_all() request.addfinalier(teardown) return _db
def setUp(self): """Set up.""" app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['DEBUG'] = False app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + \ os.path.join(basedir, TEST_DB) self.app = app.test_client() db.create_all() # Make sure we are testing in production mode self.assertEquals(app.debug, False)
def setUp(self): """TODO: Docstring for setup. :returns: TODO """ app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['DEBUG'] = False app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + \ os.path.join(BASE_DIR, TEST_DB) self.app = app.test_client() db.create_all() self.assertEquals(app.debug, False)
def create_db(): """Create database for tests.""" db.create_all() user = User('*****@*****.**', 'password', None) user2 = User('*****@*****.**', 'other_password', None) unconfirmed = User('*****@*****.**', 'unconfirmed_password', random_str(30)) db.session.add(user) db.session.add(user2) db.session.add(unconfirmed) db.session.add(ResetPassword(user, 'resetcode', datetime.utcnow() + timedelta(hours=24))) db.session.add(ResetPassword(user2, 'resetcode2', datetime.utcnow() - timedelta(hours=24))) db.session.commit()
def setUp(self): """ Executing prior to each tasks. Create environnement where tests while be executing. Start server without the debug mode. """ app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['DEBUG'] = False app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + \ os.path.join(basedir, TEST_DB) self.app = app.test_client() db.create_all() self.assertEquals(app.debug, False)
def create(): db.create_all() author_a = User('Author A', '*****@*****.**', 'Test@123') author_b = User('Author B', '*****@*****.**', 'Test@123') db.session.add(author_a) db.session.add(author_b) db.session.add(User('admin', '*****@*****.**', 'Test@123')) db.session.commit() db.session.add(BlogPost("Good title", "Good description", author_a.id)) db.session.add(BlogPost("Well title", "Well description", author_b.id)) db.session.add(BlogPost("Great title", "Great description", author_b.id)) db.session.commit()
def setUp(self): """Setup tests.""" db.create_all() self.create_users() """Setup User tests.""" self.email = '*****@*****.**' self.password = '******' self.new_email = '*****@*****.**' self.new_password = '******' self.other_email = '*****@*****.**' self.other_password = '******' self.err_email = '*****@*****.**' self.err_password = '******'
def setUp(self): db.create_all() db.session.add( User( email="*****@*****.**", password="******", url_handle="admin" ) ) db.session.add( BlogPost( title="Test post", body="This is a test. Only a test.", author_id="1", url_handle="test_blog_post" ) ) db.session.commit()
def test_import(): input_file = open("input.csv","r") input_file = csv.DictReader(input_file) db.create_all() db.session.add(User('admin','admin','*****@*****.**','admin','admin')) db.session.add(User('alfons','alfon','*****@*****.**','alfons','alfons')) count = 0 for row in input_file: count += 1 db.session.add(Orders( 'Active', row['Order No'], row['Order Entered date'], row['Date'], row['Dead line/delivery date'], row['Order source'], row['Product Name'], row['LYS Link'],'Product Code', row['Qty.'], row['Customer Name'], row['Mail id'], row['Payment'], row['In warehouse?'], 'Procurement Date', row['Supplier'], 'USA Tracking Number', row['DHL Tracking Number'],'','','Admin' ) ) db.session.commit()
def createall(): "Create all database tables" db.create_all() _session = db.session filename = app.config["INIT_DATA"] print filename with open(filename, 'r') as f: lines = f.readlines() wordlists = [] wordheat = {} for line in lines: line = unicode(line, "utf-8") print line words = line.split(",") key_word = words[0] heat_degree = float(words[1]) wordlists.append(key_word) wordheat[key_word] = heat_degree i = 2 while i < len(words)-1: word = words[i] weight = float(words[i+1]) _session.add(Relation(key_word, word, weight)) i = i+2 wordlists.append(word) #_session.add(Heat(key_word, create_heat(12, heat_degree))) #_session.add(Word(key_word, heat_degree, words[i])) _session.commit() wordlists = list(set(wordlists)) init_all_heats(wordlists, wordheat)
def setUp(self): db.create_all() user = User(email="*****@*****.**", password="******") db.session.add(user) db.session.commit()
def recreate_db(): db.session.remove() db.drop_all() db.create_all()
def setUp(self): db.drop_all() db.create_all() user1 = User('bigrobsf', 'apassword', 'Rob', 'Conner', '*****@*****.**') db.session.add(user1) db.session.commit()
def test_db(): db.create_all() yield db db.session.remove() db.drop_all()
def setUp(self): db.create_all() db.session.add(BlogPost('kevo', 'ni yule mguyz')) db.session.add(User("admin", "*****@*****.**", "admin")) db.session.commit()
def recreatedb(): db.drop_all() db.create_all() seed_database(db) db.session.commit()
from project import create_app, db db.create_all(app=create_app())
def recreate_db(): """ recreate the database """ db.drop_all() db.create_all() db.session.commit()
def test_database(): db.create_all() yield db # testing happens here db.session.remove() db.drop_all()
def setUp(self): #print("!!!!!testing setup") db.create_all() db.session.commit()
def setUp(self): db.create_all() db.session.add(User("admin","admin")) db.session.add(Show("Firefly",True,False,180)) db.session.add(Download("test.avi",123456,"C:\\test.avi",datetime.datetime.now(),1)) db.session.commit()
def setUp(self): db.create_all() db.session.add(User('admin', '*****@*****.**', 'admin')) db.session.add(BlogPost('Test post', 'This is a test. Only a test.', 'admin')) db.session.commit()
def recreate_db(): """重新创建数据表.""" db.drop_all() db.create_all() db.session.commit()
def recreate_db(): db.create_all() db.session.commit()
def initdb(drop): if drop: db.drop_all() db.create_all() click.echo("初始化数据库")
def setUp(self): db.create_all() db.session.commit()
def setUp(self): # """Disable CSRF, initialize a sqlite DB and seed a user""" db.create_all() user = User("eschoppik", "secret", "Elie S", "*****@*****.**") db.session.add(user) db.session.commit()
def recreate_db(): """ Recreate db """ db.drop_all() db.create_all() db.session.commit()
def create_them(): db.create_all() return "New Tables are created!"
def create_database(): """Create empty database.""" from project.models import album_song, album, library, song # noqa app = create_app('config.Development') with app.app_context(): db.create_all()
def create_db(): """Creates the db tables.""" db.create_all() load_movies() load_links()
def setUp(self): db.create_all() user = User(username="******", password="******") db.session.add(user) db.session.commit()
def recreate_db(): '''Recreate a database''' db.drop_all() db.create_all() db.session.commit()
def create_db(): db.drop_all() db.create_all() db.session.commit()
def initdb(username, password): click.echo("Initializing the database...") db.create_all() admin = User.query.get(1) if admin: click.echo("The administrator already exists, updating...") admin.username = username admin.password = password else: admin = User(username=username, password=password) db.session.add(admin) db.session.commit() # for i in range(20): # initial = Article(id=i+1, title='Hello', author='TuringC', body='Welcome to my blog!'+ 'This is NO.' + str(i) + ' !') # db.session.add(initial) initial = Article(id=1, title='Hello Visitor', author='TuringC', body='Welcome to TuringC\'s blog!') db.session.add(initial) initial = Article( title='离散数学及其应用', author='TuringC', body= '计算机科学丛书:离散数学及其应用(原书第7版)》是介绍离散数学理论和方法的经典教材,已经成为采用率最高的离散数学教材,被美国众多名校用作教材,获得了极大的成功。中文版也已被国内大学广泛采用为教材。作者参考使用教师和学生的反馈,并结合自身对教育的洞察,对第7版做了大量的改进,使其成为更有效的教学工具。《计算机科学丛书:离散数学及其应用(原书第7版)》可作为1至2个学期的离散数学课入门教材,适用于数学、计算机科学、计算机工程、信息技术等专业的学生。' ) db.session.add(initial) initial = Article( title='统计学完全教程', author='TuringC', body= '由美国当代著名统计学家L·沃塞曼所著的《统计学元全教程》是一本几乎包含了统计学领域全部知识的优秀教材。本书除了介绍传统数理统计学的全部内容以外,还包含了Bootstrap方法(自助法)、独立性推断、因果推断、图模型、非参数回归、正交函数光滑法、分类、统计学理论及数据挖掘等统计学领域的新方法和技术。本书不但注重概率论与数理统计基本理论的阐述,同时还强调数据分析能力的培养。本书中含有大量的实例以帮助广大读者快速掌握使用R软件进行统计数据分析。' ) db.session.add(initial) initial = Article( title='编译原理:原理、技术与工具', author='TuringC', body= '本书全面、深入地探讨了编译器设计方面的重要主题,包括词法分析、语法分析、语法制导定义和语法制导翻译、运行时刻环境、目标代码生成、代码优化技术、并行性检测以及过程间分析技术,并在相关章节中给出大量的实例。与上一版相比,本书进行了全面的修订,涵盖了编译器开发方面的最新进展。每章中都提供了大量的系统及参考文献。\n 本书是编译原理课程方面的经典教材,内容丰富,适合作为高等院校计算机及相关专业本科生及研究生的编译原理课程的教材,也是广大技术人员的极佳参考读物。' ) db.session.add(initial) initial = Article( title='形式语言与自动机导论', author='TuringC', body= '本书是理论计算机科学方面的优秀教材,主要介绍形式语言、自动机、可计算性和相关内容。本书特别注意定义、定理的准确性和严格性,在定理的证明中给出了直观的动机和框架,避免多余的数学细节,这有利于培养学生形式化和严格的数学推理能力,加强对问题的理解;本书通过精心设计的大量示例,生动剖析了各种定理和定义,概念清晰,深入浅出。每章后面还给出了难度不同的习题,并给出部分习题的解答,可使学生加深对基本原理的理解并增强应用能力。 本书主要介绍形式语言、自动机、可计算性和相关内容。主要内容包括:计算理论导引、有穷自动机、正则语言与正则文法、上下文无关语言及文法、下推自动机、图灵机、形式语言和自动机的层次结构、计算复杂性等。每节后面都给出了习题,并包含部分习题的解答,方便教学。' ) db.session.add(initial) initial = Article( title='深入理解计算机系统', author='TuringC', body= '本书从程序员的视角详细阐述计算机系统的本质概念,并展示这些概念如何实实在在地影响应用程序的正确性、性能和实用性。全书共12章,主要内容包括信息的表示和处理、程序的机器级表示、处理器体系结构、优化程序性能、存储器层次结构、链接、异常控制流、虚拟存储器、系统级I/O、网络编程、并发编程等。书中提供大量的例子和练习,并给出部分答案,有助于读者加深对正文所述概念和知识的理解。\n 本书的最大优点是为程序员描述计算机系统的实现细节,帮助其在大脑中构造一个层次型的计算机系统,从最底层的数据在内存中的表示到流水线指令的构成,到虚拟存储器,到编译系统,到动态加载库,到最后的用户态应用。通过掌握程序是如何映射到系统上,以及程序是如何执行的,读者能够更好地理解程序的行为为什么是这样的,以及效率低下是如何造成的。' ) db.session.add(initial) initial = Article( title='深入理解Java虚拟机:JVM高级特性与最佳实践', author='TuringC', body= '深入理解Java虚拟机:JVM高级特性与最佳实践(第2版)》内容简介:第1版两年内印刷近10次,4家网上书店的评论近4?000条,98%以上的评论全部为5星级的好评,是整个Java图书领域公认的经典著作和超级畅销书,繁体版在台湾也十分受欢迎。第2版在第1版的基础上做了很大的改进:根据最新的JDK 1.7对全书内容进行了全面的升级和补充;增加了大量处理各种常见JVM问题的技巧和最佳实践;增加了若干与生产环境相结合的实战案例;对第1版中的错误和不足之处的修正;等等。第2版不仅技术更新、内容更丰富,而且实战性更强。' ) db.session.add(initial) initial = Article( title='操作系统:精髓与设计原理', author='TuringC', body= '本书不仅全面地讲述了操作系统的基本概念、原理和方法,还清楚地展现了当代操作系统的本质和特点。作者针对近几年操作系统领域的最新变化,对操作系统的设计原理进行深入的阐述,同时将其对操作系统整个领域全面而深入的理解呈现给读者。' ) db.session.add(initial) db.session.commit() click.echo('Initialized Database.')
def initdb(drop): """Initialize the database.""" if drop: db.drop_all() db.create_all() click.echo('Initialized database.')
def recreate_db(): """Recreates a database.""" db.drop_all() db.create_all() db.session.commit()
from project import db # from project.models import Task, User #from datetime import date #create the datbase and the db table db.create_all() #insert data # db.session.add(Task("Finish this tutorial", date(2015,3,13), 10, 1)) # db.session.add(Task("Finish Real Python", date(2015,3,13), 10, 1)) # db.session.add(User('admin', "*****@*****.**", "admin", "admin" )) # db.session.add(Task('Finish this tutorial', date(2015, 3, 13), 10, date(2015, 2, 13), 1,1)) #commit the changes db.session.commit()
class TestCase(unittest.TestCase): # executed prior to each test with app.app_context(): db.drop_all() db.create_all() def setUp(self): app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['DEBUG'] = False # app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + \ # os.path.join(app.config['BASEDIR'], TEST_DB) self.app = app.test_client() self.app.post('/api/v1/applicants', data=json.dumps( dict(first_name='bar', last_name="Kirtfield", school='VCU', position='dev intern', degree='eyesight')), content_type='application/json', follow_redirects=True) self.app.post('/api/v1/applicants', data=json.dumps( dict(first_name='Ryan', last_name="Kirtfield", school='Penn State', position='dev intern', degree='mathematics')), content_type='application/json', follow_redirects=True) self.app.post('/api/v1/applicants', data=json.dumps( dict(first_name='Little', last_name="John", school='VT', position='dev intern', degree='Health')), content_type='application/json', follow_redirects=True) self.app.post('/api/v1/applicants', data=json.dumps( dict(first_name='Lion', last_name="Welsh", school='Harvard', position='dev intern', degree='good')), content_type='application/json', follow_redirects=True) #################### ##POSTING ENTRIES### #################### def test_post_app1(self): tester = app.test_client(self) res = self.app.post('/api/v1/applicants', data=json.dumps( dict(first_name='bar', last_name="Kirtfield", school='VCU', position='dev intern', degree='eyesight')), content_type='application/json', follow_redirects=True) self.assertEqual(res.status_code, 201) def test_post_missing_fields(self): tester = app.test_client(self) res = self.app.post('/api/v1/applicants', data=json.dumps( dict(school='VCU', position='dev intern', degree='eyesight')), content_type='application/json', follow_redirects=True) self.assertEqual(res.status_code, 400) def test_post_invalid_position(self): tester = app.test_client(self) res = self.app.post('/api/v1/applicants', data=json.dumps( dict(school='VCU', position='cat caller', degree='eyesight')), content_type='application/json', follow_redirects=True) self.assertEqual(res.status_code, 400) #################### ##Testing Routes#### #################### def test_index(self): tester = app.test_client(self) res = tester.get('/api/v1/applicants', content_type='application/json') self.assertEqual(res.status_code, 200) def test_index_without_json(self): tester = app.test_client(self) res = tester.get('/api/v1/applicants', content_type='application/json') self.assertEqual(res.status_code, 200) def test_fetch_application(self): tester = app.test_client(self) res = tester.get('/api/v1/applicants/2', content_type='application/json') self.assertEqual(res.status_code, 200) #################### ##FETCHING DATA##### #################### def test_fetch_application_nonexist(self): tester = app.test_client(self) res = tester.get('/api/v1/applicants/200', content_type='application/json') self.assertEqual(res.status_code, 404) def test_delete_nonexisting_index(self): tester = app.test_client(self) res = tester.delete('/api/v1/applicants/200 ', content_type='application/json') self.assertEqual(res.status_code, 404) def test_delete_exists_index(self): tester = app.test_client(self) res = tester.delete('/api/v1/applicants/1', content_type='application/json') self.assertEqual(res.status_code, 200) def test_fetch_application_nonexist_after_delete(self): tester = app.test_client(self) res = tester.get('/api/v1/applicants/1', content_type='application/json') self.assertEqual(res.status_code, 404) #################### ##Updating ENTRIES## #################### def test_update_some_prop(self): tester = app.test_client(self) res = self.app.put('/api/v1/applicants/2', data=json.dumps(dict(first_name='bar')), content_type='application/json', follow_redirects=True) self.assertEqual(res.status_code, 200) def test_update_all_prop(self): tester = app.test_client(self) res = self.app.put('/api/v1/applicants/2', data=json.dumps( dict(first_name='bar', last_name="Kirtfield", school='VCU', position='dev engineer', degree='eyesight')), content_type='application/json', follow_redirects=True) self.assertEqual(res.status_code, 200) ########################### ##TEST POST IN PUT METHOD## ########################### def test_wrong_method(self): tester = app.test_client(self) res = self.app.post('/api/v1/applicants/7', data=json.dumps( dict(first_name='bar', last_name="Kirtfield", school='VCU', position='dev engineer', degree='eyesight')), content_type='application/json', follow_redirects=True) self.assertEqual(res.status_code, 405) ########################### ##TEST POST IN GET METHOD## ########################### def test_wrong_method_post_in_get(self): tester = app.test_client(self) res = self.app.post('/api/v1/applicants/7', data=json.dumps( dict(first_name='bar', last_name="Kirtfield", school='VCU', position='dev engineer', degree='eyesight')), content_type='application/json', follow_redirects=True) self.assertEqual(res.status_code, 405) ########################### ##TEST PUT IN GET METHOD### ########################### def test_wrong_method_put_in_get(self): tester = app.test_client(self) res = self.app.put('/api/v1/applicants', data=json.dumps( dict(first_name='bar', last_name="Kirtfield", school='VCU', position='dev engineer', degree='eyesight')), content_type='application/json', follow_redirects=True) self.assertEqual(res.status_code, 405) ########################### ##TEST PUT WITH EMPTY###### ########################### def test_wrong_method_put_empty(self): tester = app.test_client(self) res = self.app.put('/api/v1/applicants', data=json.dumps(dict()), content_type='application/json', follow_redirects=True) self.assertEqual(res.status_code, 405) ########################### ##TEST SEARCH METHODS###### ########################### def test_search_school(self): tester = app.test_client(self) res = self.app.get('/api/v1/applicants/school/vcu', content_type='application/json', follow_redirects=True) self.assertEqual(res.status_code, 200) def test_search_school_no_results(self): tester = app.test_client(self) res = self.app.get('/api/v1/applicants/school/lslslsls', data=json.dumps(dict()), content_type='application/json', follow_redirects=True) self.assertEqual(res.status_code, 200) def test_seach_name(self): tester = app.test_client(self) res = self.app.get('/api/v1/applicants/lastname/kirtfield', data=json.dumps(dict()), follow_redirects=True) self.assertEqual(res.status_code, 200) def test_search_name_no_results(self): tester = app.test_client(self) res = self.app.get('/api/v1/applicants/lastname/jwoefjei', data=json.dumps(dict()), follow_redirects=True) self.assertEqual(res.status_code, 200)
def recreate_db(): '''Commnad recreates database''' db.drop_all() db.create_all() db.session.commit()
# db_create.py from project import db # create the database and the db table db.create_all() # commit the changes db.session.commit()
def create_db(): """Creates the db tables.""" db.create_all()
def setUp(self): db.create_all() db.session.add(User("admin", "*****@*****.**", "admin")) db.session.add( BlogPost("Test post", "This is a test. Only a test.", "admin")) db.session.commit()