示例#1
0
 def change_password(auth_token, id, password, new_password):
     return app.test_client().post(
         '/u/v1/user/changepassword',
         headers=dict(Authorization='Bearer {}'.format(auth_token)),
         data=json.dumps(
             dict(id=id, password=password, newpassword=new_password)),
         content_type='application/json')
示例#2
0
 def get_all_product(auth_token):
     return app.test_client().get(
         '/p/v1/product',
         headers=dict(
             Authorization='Bearer {}'.format(auth_token) 
         ),        
         content_type='application/json'
     )          
示例#3
0
 def get_all_product_by_vendor(auth_token, vendor_id):
     return app.test_client().get(
         '/p/v1/product/vendor/{}'.format(vendor_id),
         headers=dict(
             Authorization='Bearer {}'.format(auth_token) 
         ),        
         content_type='application/json'
     )  
示例#4
0
 def get_contact(auth_token, id):
     return app.test_client().get(
         '/c/v1/contact/{}'.format(id),
         headers=dict(
             Authorization='Bearer {}'.format(auth_token) 
         ),        
         content_type='application/json'
     )            
示例#5
0
 def update_user(auth_token, id, firstname, lastname, status):
     return app.test_client().put(
         '/u/v1/user',
         headers=dict(Authorization='Bearer {}'.format(auth_token)),
         data=json.dumps(
             dict(id=id,
                  firstname=firstname,
                  lastname=lastname,
                  status=status)),
         content_type='application/json')
示例#6
0
 def register_user(auth_token):
     return app.test_client().post(
         '/u/v1/user',
         headers=dict(Authorization='Bearer {}'.format(auth_token)),
         data=json.dumps(
             dict(email='*****@*****.**',
                  firstname='erwin',
                  lastname='alberto',
                  password='******')),
         content_type='application/json')
示例#7
0
 def update_vendor(auth_token, vendor_id, vendor_name, website_name,
                   status):
     return app.test_client().put(
         '/v/v1/vendor',
         headers=dict(Authorization='Bearer {}'.format(auth_token)),
         data=json.dumps(
             dict(id=vendor_id,
                  name=vendor_name,
                  website=website_name,
                  status=status,
                  user_by='jalberto')),
         content_type='application/json')
示例#8
0
 def add_attachment(auth_token, attachment):
     return app.test_client().post(
         '/a/v1/attachment',
         headers=dict(Authorization='Bearer {}'.format(auth_token)),
         data=json.dumps(
             dict(attachment_id=attachment.attachment_id,
                  attachment_type_id=attachment.attachment_type_id,
                  name=attachment.name,
                  link=attachment.link,
                  description=attachment.description,
                  user_by='ealberto')),
         content_type='application/json')
示例#9
0
 def update_contact(auth_token, contact):
     return app.test_client().put(
         '/c/v1/contact',
         headers=dict(
             Authorization='Bearer {}'.format(auth_token) 
         ),        
         data=json.dumps(dict(
             id = contact.id,
             name = contact.name,
             user_by = 'jalberto'          
         )),
         content_type='application/json'
     )            
示例#10
0
 def update_product(auth_token, vendor_id, product):
     return app.test_client().put(
         '/p/v1/product',
         headers=dict(
             Authorization='Bearer {}'.format(auth_token) 
         ),        
         data=json.dumps(dict(
             id = product.id,
             vendor_id = vendor_id,
             product_name = product.product_name,
             user_by = 'jalberto'           
         )),
         content_type='application/json'
     )    
示例#11
0
 def get_all_active_vendor(auth_token):
     return app.test_client().get(
         '/v/v1/vendor/active',
         headers=dict(Authorization='Bearer {}'.format(auth_token)),
         content_type='application/json')
示例#12
0
 def delete_attachment(auth_token, id):
     return app.test_client().delete(
         '/a/v1/attachment/{}'.format(id),
         headers=dict(Authorization='Bearer {}'.format(auth_token)),
         content_type='application/json')
示例#13
0
 def update_attachment(auth_token, id, attachment):
     return app.test_client().put(
         '/a/v1/attachment/{}'.format(id),
         headers=dict(Authorization='Bearer {}'.format(auth_token)),
         data=json.dumps(dict(name=attachment.name, user_by='jalberto')),
         content_type='application/json')
示例#14
0
 def get_all_attachments(auth_token, attachmment_id, attachment_type_id):
     return app.test_client().get(
         '/a/v1/attachment/{}/{}'.format(attachmment_id,
                                         attachment_type_id),
         headers=dict(Authorization='Bearer {}'.format(auth_token)),
         content_type='application/json')