def test__get__not_service_owner__cannot_select_requestor(
        client, faker, loggedin_user):
    s = faker.get_test_service()
    resp = lbrc_services_get(client, _url(service_id=s.id), loggedin_user)
    assert resp.status_code == status.HTTP_200_OK

    assert resp.soup.find("select", id="requestor_id") is None
def test__get__common_form_fields(client, faker, loggedin_user):
    s = faker.get_test_service()
    resp = lbrc_services_get(client, _url(service_id=s.id), loggedin_user)
    assert resp.status_code == status.HTTP_200_OK

    assert resp.soup.find("select", id="organisation_id") is not None
    assert resp.soup.find("input", type='text', id="name") is not None
    assert resp.soup.find("input", type='text',
                          id="organisation_description") is not None
def test__get__buttons(client, faker, endpoint, loggedin_user):
    s = faker.get_test_service()
    url = url_for(endpoint)

    resp = lbrc_services_get(client, _url(service_id=s.id, prev=url),
                             loggedin_user)
    assert resp.status_code == status.HTTP_200_OK

    assert resp.soup.find("a", href=url) is not None
    assert resp.soup.find("button", type="submit", string="Save") is not None
Exemple #4
0
def test__todo__statuses(client, faker, status_code, status_name,
                         loggedin_user):
    todo = faker.get_test_todo(status=status_code)

    resp = lbrc_services_get(client,
                             _url(task_id=todo.task.id),
                             loggedin_user,
                             has_form=True)

    assert_results(resp, [todo])
Exemple #5
0
def test__services(client, faker, n, loggedin_user):
    services = [faker.get_test_service() for _ in range(n)]

    resp = lbrc_services_get(client, _url(), loggedin_user)

    assert resp.status_code == status.HTTP_200_OK
    content = resp.soup.find(id="content")
    assert len(content.find_all("a", "btn")) == n

    for s in services:
        assert content.find("a", string=re.compile(s.name)) is not None
def test__create_task__input_fields(client, faker, field_type_name,
                                    loggedin_user):
    ft = FieldType._get_field_type(field_type_name)
    s, f = faker.get_test_field_of_type(ft)

    resp = lbrc_services_get(client, _url(service_id=s.id), loggedin_user)
    assert resp.status_code == status.HTTP_200_OK

    assert resp.soup.find(ft.html_tag,
                          type=ft.html_input_type,
                          id=f.field_name) is not None
Exemple #7
0
def test__todo__search__name(client, faker, loggedin_user):
    task = faker.get_test_task()

    matching = faker.get_test_todo(task=task, description="Mary")
    un_matching = faker.get_test_todo(task=task, description="Joseph")

    resp = lbrc_services_get(client,
                             _url(task_id=task.id, search='ar'),
                             loggedin_user,
                             has_form=True)

    assert_results(resp, [matching])
Exemple #8
0
def _get(client, url, loggedin_user, has_form):
    resp = lbrc_services_get(client, url, loggedin_user, has_form)

    assert__search_html(resp.soup, clear_url=_url(external=False))

    assert__select(soup=resp.soup,
                   id='service_id',
                   options=_get_service_choices())
    assert__select(soup=resp.soup,
                   id='task_status_type_id',
                   options=_get_combined_task_status_type_choices())

    return resp
Exemple #9
0
def test__todos(client, faker, for_this_task, for_other_tasks, loggedin_user):
    this_task = faker.get_test_task()
    other_task = faker.get_test_task()

    this_task_todos = [
        faker.get_test_todo(task=this_task) for _ in range(for_this_task)
    ]
    other_task_todos = [
        faker.get_test_todo(task=other_task) for _ in range(for_other_tasks)
    ]

    resp = lbrc_services_get(client,
                             _url(task_id=this_task.id),
                             loggedin_user,
                             has_form=True)

    assert_results(resp, this_task_todos)