def supplier_domain(app, domains, supplier): with app.app_context(): db.session.add( SupplierDomain(id=1, domain_id=1, status='unassessed', supplier_id=1)) yield db.session.query(SupplierDomain).filter( SupplierDomain.id == 1).first()
def supplier_domains(app, request, suppliers): with app.app_context(): for s in suppliers: for i in range(1, 6): db.session.add(SupplierDomain(supplier_id=s.id, domain_id=i)) db.session.flush() db.session.commit() yield SupplierDomain.query.all()
def supplier_domains(self, app): with app.app_context(): db.session.add( SupplierDomain(id=100, supplier_id=100, domain_id=1, status='assessed', price_status='approved')) db.session.add( SupplierDomain(id=101, supplier_id=100, domain_id=2, status='unassessed', price_status='unassessed')) db.session.add( SupplierDomain(id=102, supplier_id=100, domain_id=3, status='unassessed', price_status='unassessed')) yield db.session.query(SupplierDomain).all()
def recruiter_supplier_domains(app, request, recruiter): with app.app_context(): for i in range(1, 6): db.session.add( SupplierDomain( domain_id=i, price_status='approved', status='assessed', supplier_id=recruiter.id, )) db.session.commit() yield db.session.query(SupplierDomain).filter( SupplierDomain.supplier_id == recruiter.id)
def supplier_domains(app, request, domains, suppliers): params = request.param if hasattr(request, 'param') else {} status = params['status'] if 'status' in params else 'assessed' price_status = params[ 'price_status'] if 'price_status' in params else 'approved' with app.app_context(): for domain in domains: db.session.add( SupplierDomain(supplier_id=suppliers[0].id, domain_id=domain.id, status=status, price_status=price_status)) db.session.flush() db.session.commit() yield SupplierDomain.query.all()
def supplier_domains(app, request, suppliers): with app.app_context(): for s in suppliers: for i in range(1, 6): supplier_domain = SupplierDomain(supplier_id=s.id, domain_id=i, status='assessed', price_status='approved') db.session.add(supplier_domain) db.session.flush() db.session.add( CaseStudy(data={'service': supplier_domain.domain.name}, status='approved', supplier_code=s.code)) db.session.commit() yield SupplierDomain.query.all()
def supplier_domains(app, request, suppliers): params = request.param if hasattr(request, 'param') else {} status = params['status'] if 'status' in params else 'unassessed' price_status = params[ 'price_status'] if 'price_status' in params else 'unassessed' with app.app_context(): for s in suppliers: for i in range(1, 6): db.session.add( SupplierDomain(supplier_id=s.id, domain_id=i, status=status, price_status=price_status)) db.session.flush() db.session.commit() yield SupplierDomain.query.all()
def set_supplier_domain_status(self, supplier_id, domain_id, status, price_status, do_commit=True): existing = self.filter( SupplierDomain.domain_id == domain_id, SupplierDomain.supplier_id == supplier_id).one_or_none() if existing: existing.status = status existing.price_status = price_status return self.save(existing, do_commit) else: supplier_domain = SupplierDomain(domain_id=domain_id, supplier_id=supplier_id, status=status, price_status=price_status) return self.save(supplier_domain, do_commit)
def supplier_domains(self, app): with app.app_context(): db.session.add( SupplierDomain(id=1, supplier_id=1, domain_id=11, status='unassessed')) db.session.add( SupplierDomain(id=2, supplier_id=1, domain_id=8, status='unassessed')) db.session.add( SupplierDomain(id=3, supplier_id=1, domain_id=6, status='unassessed')) db.session.add( SupplierDomain(id=4, supplier_id=1, domain_id=1, status='rejected')) db.session.add( SupplierDomain(id=5, supplier_id=2, domain_id=11, status='assessed')) db.session.add( SupplierDomain(id=6, supplier_id=2, domain_id=8, status='rejected')) db.session.add( SupplierDomain(id=7, supplier_id=2, domain_id=1, status='unassessed')) yield db.session.query(SupplierDomain).all()