Esempio n. 1
0
def test_list_dogs_contains_submitted_dog_id(populated_database_conn):
    conn = populated_database_conn

    dogs_before = _list_dogs(conn)

    dog_data = {
        "image": "base64",
        "dog_age": 1,
        "dog_breed": "test",
        "dog_weight": 0,
        "user_email": "test"
    }
    dog_id = _submit_dog(dog_data, conn)

    dogs_after = _list_dogs(conn)
    assert dogs_after == dogs_before + [dog_id]
Esempio n. 2
0
def test_get_ranking(populated_database_conn):
    conn = populated_database_conn

    ids = _list_dogs(conn)

    voter_data = {
            "gender_identity": "test",
            "age": 20,
            "education": 0,
            "location": "test",
            "dog_ownership": False,
            "northeastern_relationship": "test",
        }

    registration_result = _register_voter(voter_data, conn)
    uuid = registration_result["voter_uuid"]

    id1 = ids[0]

    for i in range(100):
        for id in ids[1:]:
            _submit_vote({
                "dog1_id": id1,
                "dog2_id": id,
                "winner": id1,
                "voter_uuid": uuid,
            }, conn)

    ranking = _get_ranking(conn)
    assert ranking[0] == id1
Esempio n. 3
0
def test_add_dog_only_submitted_dog_id(conn):
    dog_data = {
        "image": "base64",
        "dog_age": 1,
        "dog_breed": "test",
        "dog_weight": 0,
        "user_email": "test"
    }
    dog_id = _submit_dog(dog_data, conn)

    dogs_after = _list_dogs(conn)
    assert dogs_after == [dog_id]
Esempio n. 4
0
def test_list_dogs_all_dogs_valid_for_get_votes(conn):
    for dog in _list_dogs(conn):
        _get_votes({"id": dog}, conn)
        _get_dog({"id": dog}, conn)