Exemple #1
0
    def test_000001_test(self):
        # Creating the app
        create_app()

        # Populating
        populate_tables()
        self.assertEqual(1, 1)
        print("Test 1:Hello, Tests!")
Exemple #2
0
    def test_a_3_001_pc_insert(self):
        db_drop_and_create_all()
        populate_tables()
        pc1 = ProductCategory(product_id=3, category_id=7)
        pc1.insert()
        pcs = ProductCategory.query().all()

        self.assertEqual(len(pcs), 16)
        print("Test a_3_1: pc insert")
Exemple #3
0
 def populate_all_tables():
     test_only()
     #This endpoint will clear all the data in the database and
     #populate with new data
     try:
         populate_tables()
         return jsonify({"success": True})
     except:
         abort(422)  #Unprocessible
     """
Exemple #4
0
def syncdb(options, reset=False, create=False):
    from models import DB_FILE, database, create_tables, populate_tables
    import os
    if reset:
        os.unlink(DB_FILE)
        database.connect()
        create_tables()()
        populate_tables()
    elif create:
        database.connect()
        create_tables()()

    else:
        dbshell(options)
Exemple #5
0
def rebuilddb(options):
    '''
    Rebuild DB
    '''
    from peewee import drop_model_tables, create_model_tables, find_subclasses
    from models import BaseModel, populate_tables
    print "Reconsruyendo la base de datos..."
    models = find_subclasses(BaseModel)
    print "Drop tables..."
    drop_model_tables(models)
    print "Cereate tables..."
    create_model_tables(models)
    CONFIG = {
            'default':[
                    dict(address='192.168.1.97', description="Placa de prueba 1 "),
                    dict(address='192.168.1.98', description="Placa de prueba 2"),
            ],
            'test':[
                dict(address='127.0.0.1', description=u"Conexión con localhost"),
            ]
        }
    print "Populating..."
    for name, list_of_comaster_cfg in CONFIG.iteritems():
        populate_tables(name, list_of_comaster_cfg)
Exemple #6
0
    def test_a_1_004_populate(self):
        populate_tables()
        users = User.query.all()

        self.assertEqual(len(users), 6)
        print("Test a_1_4: Populate Tables")
Exemple #7
0
def add(request):
    populate_tables()
    return {"success": True}
Exemple #8
0
    def test_a_3_004_populate(self):
        populate_tables()
        pcs = ProductCategory.query().all()

        self.assertEqual(len(pcs), 15)
        print("Test a_3_4: Populate Tables")
Exemple #9
0
    def test_a_2_004_populate(self):
        populate_tables()
        categories = Category.query().all()

        self.assertEqual(len(categories), 13)
        print("Test a_2_4: Populate Tables")
Exemple #10
0
    def test_a_1_004_populate(self):
        populate_tables()
        products = Product.query().all()

        self.assertEqual(len(products), 5)
        print("Test a_1_4: Populate Tables")