コード例 #1
0
def db_init():
    """
    Function to initialize DB, create
    and add tables
    """
    DB.init('customer.db')
    DB.create_tables([Customer])
    add_customer(CUSTOMER_LIST)
コード例 #2
0
def setup_db():
    """ Sets up database for test cases """
    DB.drop_tables([Customer])
    #    DB.close()
    DB.create_tables([Customer])
    add_customer(1, "Leo", "Messi", "100 Las Ramblas", 1234567890,
                 "*****@*****.**", True, 5000000.00)
    add_customer(2, "Ivan", "Rakitic", "111 Las Ramblas", 2345678901,
                 "*****@*****.**", True, 2000000.00)
    add_customer(3, "Gerard", "Pique", "123 Las Ramblas", 3333333333,
                 "*****@*****.**", True, 300000.00)
コード例 #3
0
def db_init():
    """
    Function to initialize DB, create/add
    tables and add customer data to the DB
    """
    DB.init('customer.db')
    DB.create_tables([Customer])
    [
        add_customer(customer) for customer in CUSTOMER_LIST
        if customer is not None
    ]
コード例 #4
0
 def setUp(self):
     DB.create_tables([Customer])
コード例 #5
0
"""Creates a customer database with peewee ORM, sqlite and python"""
import logging
from customer_model import Customer, DB

logging.basicConfig(level=logging.INFO)

logging.info("Creating the Customer table")
DB.create_tables([Customer])
logging.info("Closing the customer database")
#DB.close()
コード例 #6
0
def setup_db():
    """ Sets up database for test cases """
    DB.drop_tables([Customer])
    DB.close()
    DB.create_tables([Customer])
    DB.close()