def case_2(self): self.current_case = 'case 2' _login = login.Login() _login.login(self.userinfo_super['username'], self.userinfo_super['password'], self.userinfo_super['role']) self.cookie = _login.cookie self.csrf = _login.csrf self.token = _login.token _CustomersApproval = Approval.ApprovalSettings(self.cookie, self.csrf) _CustomersApproval.close_approval() _DeleteCustomers = DeleteCustomers.DeleteCustomer( self.cookie, self.csrf, self.token) b = _DeleteCustomers.get_customer_ids() page = b[0] # page =3 for i in range(int(page)): print(i) c = _DeleteCustomers.get_customer_ids() print(c) print(c[1]) Customers_list = c[1] # print(len(Customers_list)-1) 'customer_approve[enable_customer_approve]': '1' , for i in range(len(Customers_list)): _DeleteCustomers.delete_customer(Customers_list[i])
def case_2(self): self.current_case = 'case 2' _login = login.Login() _login.login(self.userinfo_super['username'], self.userinfo_super['password'], self.userinfo_super['role']) self.cookie =_login.cookie self.csrf = _login.csrf _CustomersApproval =CustomersApproval.ApprovalSettings(self.cookie,self.csrf) _CustomersApproval.close_approval() _DeleteCustomers = DeleteCustomer.DeleteCustomer(self.cookie, self.csrf) b =_DeleteCustomers.get_customer_ids() page =b[0][0] print (page) for i in range(int(page)): c =_DeleteCustomers.get_customer_ids() Customers_list = c[1] for Customers in Customers_list: _DeleteCustomers.delete_customer(Customers)
def deny_approval(self): self.current_case = 'case 1' _login = login.Login() _login.login(self.userinfo_super['username'], self.userinfo_super['password'], self.userinfo_super['role']) self.cookie = _login.cookie self.csrf = _login.csrf _CustomersApproval = CustomersApproval.ApprovalSettings(self.cookie, self.csrf) _CustomersApproval.open_approval() # a =0 customer_id = '' dict = {} list = [] for userinfo in self.userinfo_list: print(userinfo['username']) _login.login(userinfo['username'], userinfo['password'], userinfo['role']) self.cookie = _login.cookie self.csrf = _login.csrf _AddCustomer = AddCustomer.AddCustomer(self.cookie, self.csrf) # 8个用户新增一条关闭审批的客户 ##添加 审批通过后驳回 customer_id = _AddCustomer.add_customers(approve_status='applying', DepartmentId=0) _CustomersApproval.approve_verify(customer_id) # 审批被驳回 _CustomersApproval.deny_approval(customer_id) dict.update({userinfo['username']: customer_id}) list.append(customer_id) print(list) a = list # a = [1233194, 1233195, 1233196, 1233197, 1233198, 1233199, 1233200, 1233201] b = 1 for userinfo in self.userinfo_list: print(userinfo['username']) _login.login(userinfo['username'], userinfo['password'], userinfo['role']) self.cookie = _login.cookie self.csrf = _login.csrf _UpdateCustomer = UpdateCustomer.UpdateCustomer(self.cookie, self.csrf) for i in range(b): for j in range(6): _UpdateCustomer.add_customer_revisit_log(a[b - 1 - i], date_list=self.date_list[j],data='审批驳回') b = b + 1
def approvaled(self): self.current_case = 'case 1' _login = login.Login() _login.login(self.userinfo_super['username'], self.userinfo_super['password'], self.userinfo_super['role']) self.cookie =_login.cookie self.csrf = _login.csrf _CustomersApproval = CustomersApproval.ApprovalSettings(self.cookie,self.csrf) _CustomersApproval.close_approval() dict={} list=[] for userinfo in self.userinfo_list: print (userinfo['username']) _login.login(userinfo['username'], userinfo['password'], userinfo['role']) self.cookie =_login.cookie self.csrf = _login.csrf _AddCustomer = AddCustomer.AddCustomer(self.cookie, self.csrf) # 8个用户新增一条关闭审批的客户 ## 添加 customer_id =_AddCustomer.add_customers() dict.update({userinfo['username']: customer_id}) list.append(customer_id) print(list) a=list # a = [1233194, 1233195, 1233196, 1233197, 1233198, 1233199, 1233200, 1233201] b = 1 for userinfo in self.userinfo_list: print(userinfo['username']) _login.login(userinfo['username'], userinfo['password'], userinfo['role']) self.cookie = _login.cookie self.csrf = _login.csrf _UpdateCustomer = UpdateCustomer.UpdateCustomer(self.cookie, self.csrf,self.token) for i in range(b): for j in range(6): _UpdateCustomer.add_customer_revisit_log(a[b - 1 - i], date_list=self.date_list[j],data='关闭审批') b = b + 1
def case_1(self): self.current_case = 'case 1' _login = login.Login() _login.login(self.userinfo_super['username'], self.userinfo_super['password'], self.userinfo_super['role']) self.cookie = _login.cookie self.csrf = _login.csrf _CustomersApproval = Approval.ApprovalSettings(self.cookie, self.csrf) _CustomersApproval.close_approval() a = 1 customers = {} for userinfo in self.userinfo_list: print(userinfo['username']) _login.login(userinfo['username'], userinfo['password'], userinfo['role']) self.cookie = _login.cookie self.csrf = _login.csrf _AddCustomers = AddCustomers.AddCustomer(self.cookie, self.csrf) _CustomersApprovall = Approval.ApprovalSettings( self.cookie, self.csrf) for i in range(6 * a): month = int(math.ceil((i + 1) / a)) # print(month) if userinfo['username'] == '13799999999' and i >= 18: #添加客户 id = _AddCustomers.add_customers(DepartmentId=1) else: id = _AddCustomers.add_customers() if month not in customers: customers[month] = [] customers[month].append(id) a += 1 self.customers = customers for i in range(6): self.sql(self.date_list[i], tuple(customers[i + 1])) _login.login(self.userinfo_super['username'], self.userinfo_super['password'], self.userinfo_super['role']) self.cookie = _login.cookie self.csrf = _login.csrf _CustomersApproval = Approval.ApprovalSettings(self.cookie, self.csrf) _CustomersApproval.open_approval() a = 1 customers = {} customers[1] = [] for userinfo in self.userinfo_list: _login.login(userinfo['username'], userinfo['password'], userinfo['role']) print(userinfo['username']) self.cookie = _login.cookie self.csrf = _login.csrf _AddCustomers = AddCustomers.AddCustomer(self.cookie, self.csrf) _CustomersApproval = Approval.ApprovalSettings( self.cookie, self.csrf) # 待审批的客户 customer_id = _AddCustomers.add_customers( approve_status='applying', DepartmentId=0) customers[1].append(customer_id) # print(customers_data) # 审批通过后否决 customer_id = _AddCustomers.add_customers() _CustomersApproval.approve_verify(customer_id) _CustomersApproval.deny_approval(customer_id) customers[1].append(customer_id) # 审批否决的客户 customer_id = _CustomersApproval.deny_approval( _AddCustomers.add_customers(approve_status='applying')) customers[1].append(customer_id) # 客户撤销 customer_id = _CustomersApproval.cancel_approval( _AddCustomers.add_customers(approve_status='applying')) customers[1].append(customer_id) # print(customers_data) if userinfo['username'] == '13799999999': for i in range(6 * a): month = int(math.ceil((i + 1) / a)) # print(month) if i >= 18: # 审批通过的客户 customer_id = _CustomersApproval.approve_verify( _AddCustomers.add_customers( approve_status='applying', DepartmentId=1)) else: customer_id = _CustomersApproval.approve_verify( _AddCustomers.add_customers( approve_status='applying', DepartmentId=0)) if month not in customers: customers[month] = [] customers[month].append(customer_id) else: for i in range(6 * a): month = int(math.ceil((i + 1) / a)) # print(month) # 审批通过的客户 customer_id = _CustomersApproval.approve_verify( _AddCustomers.add_customers(approve_status='applying', DepartmentId=0)) if month not in customers: customers[month] = [] customers[month].append(customer_id) # print(customers_data) a += 1 print(customers) for i in range(6): self.sql(self.date_list[i], tuple(customers[i + 1]))