def test_CRUD_Pet(pet_id, pet_name):
    # Create and return a new Pet
    pet = petstore_requests.create_pet(pet_id, pet_name)
    assert pet.status_code == 200
    pet = json.loads(pet.content)

    # Verify The Pet was created with correct data
    petstore_requests.validate_response(pet)
    assert pet["name"] == pet_name
    assert pet["id"] == pet_id

    # Update this Pet_name, Verify update and return record
    updated_pet = petstore_requests.update_pet(pet_id, "Jack")
    assert updated_pet.status_code == 200
    updated_pet = json.loads(updated_pet.content)
    petstore_requests.validate_response(updated_pet)
    assert updated_pet["name"] == "Jack"
    assert updated_pet["id"] == pet_id

    # Delete the pet and demonstrate pet now deleted
    deleted_pet = petstore_requests.delete_pet(pet_id)
    assert deleted_pet.status_code == 200
    ghost_pet = petstore_requests.get_pet(pet_id)
    # Should retrun HTTP code 404 Not Found
    assert ghost_pet.status_code == 404
def test_delete_pet_and_verify(pet_id, pet_name):
    response_newpet = petstore_requests.create_pet(pet_id, pet_name)
    response_get_newpet = petstore_requests.get_pet(pet_id)
    assert response_get_newpet.status_code == 200
    assert response_newpet.content == response_get_newpet.content
    # delete the new pet
    delete_response = petstore_requests.delete_pet(pet_id)
    assert delete_response.status_code == 200
    verification_response = petstore_requests.get_pet(pet_id)
    assert verification_response.status_code == 404
def test_update_non_existing_pet(pet_name):
    response = petstore_requests.update_pet(45646545, pet_name)
    assert response.status_code == 200
    petstore_requests.delete_pet(45646545)
def test_delete_non_existing_pet():
    response = petstore_requests.delete_pet(65456446)
    assert response.status_code == 404
 def test_delete_pet(self):
     pet_id = variables.generatePetID()
     pet_name = variables.petName
     petstore_requests.create_pet(pet_id, pet_name)
     response = petstore_requests.delete_pet(pet_id)
     assert response.status_code == 200