Exemple #1
0
def load_persons(count):
    print("Downloading")
    try:
        persons = PersonService.load_persons(count)
    except requests.exceptions.ConnectionError:
        print("Could not download due to connection error.")
    else:
        print('Inserting persons into db')
        PersonService.insert_persons(persons)
        print('Done, downloaded {} new persons'.format(len(persons)))
Exemple #2
0
def test_list_with_len_n_returned_when_load_persons_with_arg_n_called():
    n = 2
    res = PersonService.load_persons(n)
    assert len(res) == n
def test_person_model_returned_when_create_from_json_called_with_valid_arg():
    n = 1
    json = PersonService.load_persons(n)
    pf = PersonFactory()
    res = pf.create_from_json(json[0])
    assert type(res) == Person