#!/usr/bin/env python


# ---Fill test data for user and related entities----
from models.region_dao import RegionDao
from models.role_dao import RoleDao
from models.user_dao import UserDao

RoleDao.createNewRole("Admin")
RegionDao.createNewRegion("Crimea")


UserDao.createNewUser('Anton', '111','Maxim','Sidorov', '*****@*****.**', 1,1)
UserDao.createNewUser('Vanya', '111','Ivan','Ivanov', '*****@*****.**', 1,1)
UserDao.createNewUser('Andrew', '111','Andrew','Petrov', '*****@*****.**', 1,1)
UserDao.createNewUser('Katya', '111','Ekaterina','Ivanova', '*****@*****.**', 1,1)




for instance in UserDao.getAllUsers():
    print(instance.id,instance.login,instance.password,instance.first_name, instance.last_name, instance.email,
          RoleDao.getRoleByID(instance.role_id).name, RegionDao.getRegionByID(instance.region_id).name)
ProductStock.add_new_record(3,2,115)
ProductStock.add_new_record(4,2,118)
ProductStock.add_new_record(5,1,115)
ProductStock.add_new_record(6,2,125)
ProductStock.add_new_record(11,3,115)
ProductStock.add_new_record(2,3,310)
ProductStock.add_new_record(4,3,118)
ProductStock.add_new_record(5,3,115)
ProductStock.add_new_record(6,3,125)

RoleDao.createNewRole("Administrator")
RoleDao.createNewRole("Merchandiser")
RoleDao.createNewRole("Supervisor")
RoleDao.createNewRole("Customer")

RegionDao.createNewRegion("North")
RegionDao.createNewRegion("West")
RegionDao.createNewRegion("South")
RegionDao.createNewRegion("East")

UserDao.createNewUser('Max', '1111','Maxim','Sidorov', '*****@*****.**',1,2)
UserDao.createNewUser('Nikol', '1111','Nikolay','Lobanov', '*****@*****.**', 4,1)
UserDao.createNewUser('Vanya', '1111','Ivan','Ivanov', '*****@*****.**', 2,1)
UserDao.createNewUser('Andrew', '1111','Andrew','Petrov', '*****@*****.**', 3,4)
UserDao.createNewUser('Katya', '1111','Ekaterina','Ivanova', '*****@*****.**', 4,3)
UserDao.createNewUser('Roma', '1111','Roman','Melnishin', '*****@*****.**', 2,1)
UserDao.createNewUser('Den', '1111','Dennis','Popov', '*****@*****.**', 3,1)
UserDao.createNewUser('Max90', '1111','Maxim','Smirnov', '*****@*****.**', 4,4)
UserDao.createNewUser('Yaroslav', '1111','Yaroslav','Lobanov', '*****@*****.**', 4,2)
UserDao.createNewUser('Seriy', '1111','Sergey','Lobanov', '*****@*****.**', 1,2)
UserDao.createNewUser('Dona', '1111','Donna','Popova', '*****@*****.**', 3,1)
Beispiel #3
0
def createRegion(name):
    validationRegionName(name)
    RegionDao.createNewRegion(name)