示例#1
0
def test_get_breed_list():
    dogs_list = Dog().get_breed_list()
    with allure.step('Check if \'husky\' breed in output dict'):
        assert 'husky' in dogs_list
    with allure.step('Check if \'meow\' breed not in output dict'):
        assert 'meow' not in dogs_list
    allure.attach(str(dogs_list), attachment_type=allure.attachment_type.TEXT)
示例#2
0
def root():
    my_animal = Animal("Fire fox", "Female", 23)
    my_animal.say_my_name()

    bootsyCallaco = Cat("Bootsy Callaco", "male", 12, "yellow", "BIG")
    scoobyDoo = Dog("Scooby Doo", "male", 50, "German Shepherd", "browny")

    bootsyCallaco.make_sound()
    scoobyDoo.make_sound()

    bootsyCallaco.say_my_name()
    scoobyDoo.say_my_name()
示例#3
0
async def create_dog(dog: DogSchema):
    local = next(get_db())
    length_dog = local.query(Dog).count()
    length_sight = local.query(Sighting).count()
    length_photo = local.query(Photo).count()
    sighting = Sighting(
        sighting_id=length_sight + 1,
        dog_id=length_dog + 1,
        latitude=dog.location[0],
        longitude=dog.location[1],
    )
    dog_model = Dog(
        dog_id=length_dog + 1,
        breed=dog.breed,
        description=dog.description,
        status=dog.status,
    )
    local.add(dog_model)
    local.add(sighting)
    if dog.url:
        photo = Photo(photo_id=length_photo + 1,
                      subject_id=length_dog + 1,
                      photo_url=dog.url)
        local.add(photo)
        local.commit()
        local.refresh(photo)
    else:
        url = "./images/PUPFINDER.png"
        photo = Photo(photo_id=length_photo + 1,
                      subject_id=length_dog + 1,
                      photo_url=url)
        local.add(photo)
        local.commit()
    local.refresh(dog_model)
    local.refresh(sighting)
    return {"dog": dog_model, "sight": sighting}
示例#4
0
def test_get_breed_random_image():
    step_is_jpg_image(Dog().get_breed_random_image('husky'))
示例#5
0
def test_get_subbreed_by_breed(inputs, outputs):
    subbreed = Dog().get_subbreed_by_breed(inputs)
    assert subbreed == outputs
示例#6
0
def test_get_images_by_breed():
    response_text = Dog().get_images_by_breed('hound')
    for item in response_text:
        step_is_jpg_image(item)
    allure.attach(str(response_text), attachment_type=allure.attachment_type.TEXT)
示例#7
0
def test_get_random_image():
    step_is_jpg_image(Dog().get_random_image())
示例#8
0
def test_response_type_message(inputs, outputs):
    response = Dog._response(inputs)
    with allure.step("Check output type"):
        assert isinstance(response, outputs)
    allure.attach(str(response), attachment_type=allure.attachment_type.TEXT)
示例#9
0
def test_find_request_negative():
    response = Dog._find_request('https://dog.ceo/api/wrong/link/all')
    with allure.step("Check status code, with invalid url"):
        assert response.status_code == HTTPStatus.NOT_FOUND
    allure.attach(response.text, attachment_type=allure.attachment_type.TEXT)
示例#10
0
def test_find_request_positive():
    response = Dog._find_request('https://dog.ceo/api/breeds/list/all')
    with allure.step("Check status code, with valid url"):
        assert response.status_code == HTTPStatus.OK
    allure.attach(response.text, attachment_type=allure.attachment_type.TEXT)