Beispiel #1
0
def test_add_existing_provider():
    um = UserManager()
    um.add_provider_by_info('*****@*****.**', 'password', 'Cena', 'John',
                            '04253634223', 'GP')
    um.add_provider_by_info('*****@*****.**', 'password', 'Cena', 'John',
                            '04253634223', 'GP')
    assert (len(um.providers) == 1)
Beispiel #2
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('*****@*****.**')
Beispiel #3
0
def test_get_service_names():
    um = UserManager()
    um.add_provider_by_info('*****@*****.**', 'password', 'Cena', 'John',
                            '04253634223', 'GP')
    assert (um.get_service_names() == ['gp'])
    um.add_provider_by_info('*****@*****.**', 'password', 'Cena', 'John',
                            '04253634223', 'Prac')
    assert (um.get_service_names() == ['gp', 'prac'])
Beispiel #4
0
def test_new_provider_to_existing_service():
    um = UserManager()
    um.add_provider_by_info('*****@*****.**', 'password', 'Cena', 'John',
                            '04253634223', 'GP')
    um.add_provider_by_info('*****@*****.**', 'password', 'Cena', 'John',
                            '04253634223', 'GP')
    assert (um.get_service_names() == ['gp'])
    assert (um.services['gp'] == ['*****@*****.**', '*****@*****.**'])
Beispiel #5
0
def um_fixture(centre_fixture):
    um = UserManager()
    um.add_patient_by_info("*****@*****.**", "pwd", "Goldstein", "Mark",
                           "126578445")
    um.add_provider_by_info("*****@*****.**", "pwd", "smith", "john", 123, "GP")
    provider = um.get_user("*****@*****.**")
    provider.add_centre(centre_fixture[0].name)
    return um
Beispiel #6
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 == [])
Beispiel #7
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')
Beispiel #8
0
def test_add_new_provider():
    um = UserManager()
    cond = um.add_provider_by_info('*****@*****.**', 'password', 'Cena',
                                   'John', '04253634223', 'GP')
    assert (cond == True)
    assert (len(um.providers) == 1)
    assert (um.providers[0].email == '*****@*****.**')
Beispiel #9
0
def um(prov_fixture1, centre_fixture1):
    um = UserManager()
    um.add_provider_by_info("*****@*****.**", "pwd", "smith", "john", 123, "GP")
    um.add_provider_by_info("*****@*****.**", "pwd", "smith", "jane", 123,
                            "Surgeon")
    um.add_provider_by_info("*****@*****.**", "pwd", "sss", "jane", 123,
                            "Physio")
    um.add_provider_by_info("*****@*****.**", "pwd", "Strange", "Stephen", 123,
                            "GP")
    return um