Esempio n. 1
0
def test_get_non_existing_user():
    um = UserManager()
    um.add_provider_by_info('*****@*****.**', 'password', 'Cena', 'John',
                            '02141244235', 'GP')
    um.add_provider_by_info('*****@*****.**', 'password', 'Cena',
                            'John', '02141244235', 'GP')
    with pytest.raises(IdentityError) as error:
        p1 = um.get_user('*****@*****.**')
Esempio n. 2
0
def test_remove_existing_provider():
    um = UserManager()
    um.add_provider_by_info('*****@*****.**', 'password', 'Cena', 'John',
                            '04253634223', 'GP')
    assert (len(um.providers) == 1)
    assert (um.providers[0].email == '*****@*****.**')
    assert (um.get_user('*****@*****.**') is not None)
    assert (um.remove_provider('*****@*****.**'))
    assert (um.providers == [])
Esempio n. 3
0
def test_remove_existing_patient():
    um = UserManager()
    um.add_patient_by_info('*****@*****.**', 'password', 'Cena', 'John',
                           '04253634223')
    assert (len(um.patients) == 1)
    assert (um.patients[0].email == '*****@*****.**')
    assert (um.get_user('*****@*****.**') is not None)
    assert (um.remove_patient('*****@*****.**'))
    assert (um.patients == [])
    assert (um.get_service_names() == [])
Esempio n. 4
0
def test_get_existing_user():
    um = UserManager()
    um.add_provider_by_info('*****@*****.**', 'password', 'Cena', 'John',
                            '02141244235', 'GP')
    um.add_provider_by_info('*****@*****.**', 'password', 'Cena',
                            'John', '02141244235', 'GP')
    p1 = um.get_user('*****@*****.**')
    assert (p1 is not None)
    assert (p1.email == '*****@*****.**')
    assert (p1.password == 'password')