def test_get_customers():

    # make a call to get all customers
    r = RequestUtility()
    rs_api =  r.get(endpoint='customers',payload=None,headers=None,expected_status_code=200)
    # verify whether the responce is not empty
    assert rs_api ,f"No customer is present"
    #import pdb ; pdb.set_trace()
    # validate response is not empty
def test_get_list_of_products():

    # make a call

    rs_api = RequestUtility().get(endpoint='products',
                                  payload=None,
                                  headers=None,
                                  expected_status_code=200)
    #import pdb;  pdb.set_trace()
    assert rs_api, f"No product in the list"
예제 #3
0
    def create_order(self, addtion_arg=None):
        payload_path = os.path.join(self.cur_file_dir, '..', 'data',
                                    'create_order.json')

        with open(payload_path) as f:
            payload = json.load(f)
            payload.update(addtion_arg)
            rs_api = RequestUtility().post(endpoint='orders',
                                           payload=payload,
                                           headers=None,
                                           expected_status_code=201)
            return rs_api
예제 #4
0
def test_existing_cusomter():
    rs_db = DB_Customer().get_random_user()
    db_id = rs_db[0]['ID']
    endpoint = f"customers/{db_id}"
    db_un = rs_db[0]['display_name']
    # import pdb ; pdb.set_trace()
    rs_api = RequestUtility().post(endpoint=endpoint,
                                   headers=None,
                                   expected_status_code=200,
                                   payload=None)
    rs_un = rs_api[1]['username']
    assert db_un == rs_un, f" db user name doesnot match with rs_un"
예제 #5
0
def test_customer_create_same_email():
    rs_db = DB_Customer().get_random_user()
    db_email = rs_db[0]['user_email']
    payload = dict()
    payload['email'] = db_email
    payload['passowrd'] = 'password'
    rs_api = RequestUtility().post(endpoint='customers',
                                   headers=None,
                                   expected_status_code=400,
                                   payload=payload)
    # import pdb ; pdb.set_trace()
    assert rs_api[1][
        'code'] == 'registration-error-email-exists', f"Expected code message was {'registration-error-email-exists'}"
    message = f"""An account is already registered with your email address. <a href="#" class="showlogin">Please log in.</a>"""
    assert len(rs_api[1]['message']) == len(message), f"Incorrect message"
예제 #6
0
 def __init__(self):
     self.product_utility = RequestUtility()
예제 #7
0
 def __init__(self):
     self.request_utility = RequestUtility()