Exemplo n.º 1
0
    def setUp(self):
        super(TestScout, self).setUp()
        # insert departments
        self.department1 = DepartmentFactory()

        # insert the users/roles
        self.admin_role = insert_a_role('admin')
        self.superadmin_role = insert_a_role('superadmin')
        self.admin_user = insert_a_user(email='*****@*****.**',
                                        role=self.admin_role,
                                        department=self.department1)
        self.superadmin_user = insert_a_user(email='*****@*****.**',
                                             role=self.superadmin_role,
                                             department=self.department1)

        # insert the companies/contracts
        self.company1 = insert_a_company(name='ship', insert_contract=False)
        self.company2 = insert_a_company(name='boat', insert_contract=False)
        insert_a_contract(description='vessel',
                          companies=[self.company2],
                          line_items=[LineItem(description='NAVY')])
        self.contract1 = insert_a_contract(
            description='sail',
            financial_id=123,
            companies=[self.company1],
            line_items=[LineItem(description='sunfish')])
        self.contract2 = insert_a_contract(description='sunfish',
                                           financial_id=456)
    def setUp(self):
        super(TestScout, self).setUp()
        # insert departments
        self.department1 = DepartmentFactory()

        # insert the users/roles
        self.admin_role = insert_a_role('admin')
        self.superadmin_role = insert_a_role('superadmin')
        self.admin_user = insert_a_user(
            email='*****@*****.**', role=self.admin_role, department=self.department1
        )
        self.superadmin_user = insert_a_user(
            email='*****@*****.**', role=self.superadmin_role, department=self.department1
        )

        # insert the companies/contracts
        self.company1 = insert_a_company(name='ship', insert_contract=False)
        self.company2 = insert_a_company(name='boat', insert_contract=False)
        insert_a_contract(
            description='vessel', companies=[self.company2], line_items=[LineItem(description='NAVY')]
        )
        self.contract1 = insert_a_contract(
            description='sail', financial_id=123, companies=[self.company1],
            line_items=[LineItem(description='sunfish')]
        )
        self.contract2 = insert_a_contract(
            description='sunfish', financial_id=456
        )
Exemplo n.º 3
0
    def setUp(self):
        from flask_migrate import upgrade
        upgrade()

        # insert the users/roles
        self.admin_role = get_a_role('admin')
        self.superadmin_role = get_a_role('superadmin')
        self.admin_user = insert_a_user(email='*****@*****.**',
                                        role=self.admin_role)
        self.superadmin_user = insert_a_user(email='*****@*****.**',
                                             role=self.superadmin_role)

        # insert the companies/contracts
        self.company_1 = insert_a_company(name='ship', insert_contract=False)
        company_2 = insert_a_company(name='boat', insert_contract=False)

        contract_type = ContractTypeFactory.create(name='test')
        self.contract_type2 = ContractTypeFactory.create(name='test2')

        self.contract1 = ContractBaseFactory.create(
            description='vessel',
            companies=[company_2],
            line_items=[LineItem(description='NAVY')],
            expiration_date=datetime.datetime.today() + datetime.timedelta(1),
            is_archived=False,
            financial_id='123',
            contract_type=contract_type)
        ContractBaseFactory.create(
            description='sail',
            financial_id='456',
            companies=[self.company_1],
            line_items=[LineItem(description='sunfish')],
            is_archived=False,
            expiration_date=datetime.datetime.today() + datetime.timedelta(1),
            contract_type=contract_type)
        ContractBaseFactory.create(
            description='sunfish',
            financial_id='789',
            properties=[
                ContractPropertyFactory.create(key='foo', value='engine')
            ],
            expiration_date=datetime.datetime.today() + datetime.timedelta(1),
            is_archived=False,
            contract_type=contract_type)
        ContractBaseFactory.create(
            description='sunfish',
            financial_id='012',
            properties=[
                ContractPropertyFactory.create(key='foo', value='engine')
            ],
            expiration_date=datetime.datetime.today() - datetime.timedelta(1),
            is_archived=False,
            contract_type=self.contract_type2)

        # db.session.execute('''
        #     REFRESH MATERIALIZED VIEW CONCURRENTLY search_view
        # ''')
        db.session.commit()
    def setUp(self):
        from flask_migrate import upgrade
        upgrade()

        # insert the users/roles
        self.admin_role = get_a_role('admin')
        self.superadmin_role = get_a_role('superadmin')
        self.admin_user = insert_a_user(email='*****@*****.**', role=self.admin_role)
        self.superadmin_user = insert_a_user(email='*****@*****.**', role=self.superadmin_role)

        # insert the companies/contracts
        self.company_1 = insert_a_company(name='ship', insert_contract=False)
        company_2 = insert_a_company(name='boat', insert_contract=False)

        contract_type = ContractTypeFactory.create(name='test')
        self.contract_type2 = ContractTypeFactory.create(name='test2')

        self.contract1 = ContractBaseFactory.create(
            description='vessel', companies=[company_2], line_items=[LineItem(description='NAVY')],
            expiration_date=datetime.datetime.today() + datetime.timedelta(1), is_archived=False,
            financial_id='123', contract_type=contract_type
        )
        ContractBaseFactory.create(
            description='sail', financial_id='456', companies=[self.company_1],
            line_items=[LineItem(description='sunfish')], is_archived=False,
            expiration_date=datetime.datetime.today() + datetime.timedelta(1),
            contract_type=contract_type
        )
        ContractBaseFactory.create(
            description='sunfish', financial_id='789',
            properties=[ContractPropertyFactory.create(key='foo', value='engine')],
            expiration_date=datetime.datetime.today() + datetime.timedelta(1), is_archived=False,
            contract_type=contract_type
        )
        ContractBaseFactory.create(
            description='sunfish', financial_id='012',
            properties=[ContractPropertyFactory.create(key='foo', value='engine')],
            expiration_date=datetime.datetime.today() - datetime.timedelta(1), is_archived=False,
            contract_type=self.contract_type2
        )

        # db.session.execute('''
        #     REFRESH MATERIALIZED VIEW CONCURRENTLY search_view
        # ''')
        db.session.commit()