Exemplo n.º 1
0
def test_get_organisations_gets_all_organisations_alphabetically_with_active_organisations_first(
        notify_db_session
):
    m_active_org = create_organisation(name='m_active_organisation')
    z_inactive_org = create_organisation(name='z_inactive_organisation', active=False)
    a_inactive_org = create_organisation(name='a_inactive_organisation', active=False)
    z_active_org = create_organisation(name='z_active_organisation')
    a_active_org = create_organisation(name='a_active_organisation')

    organisations = dao_get_organisations()

    assert len(organisations) == 5
    assert organisations[0] == a_active_org
    assert organisations[1] == m_active_org
    assert organisations[2] == z_active_org
    assert organisations[3] == a_inactive_org
    assert organisations[4] == z_inactive_org
Exemplo n.º 2
0
def get_organisations():
    organisations = [
        org.serialize_for_list() for org in dao_get_organisations()
    ]

    return jsonify(organisations)
Exemplo n.º 3
0
def get_organisations():
    data = organisation_schema.dump(dao_get_organisations(), many=True).data
    return jsonify(organisations=data)