def test_more_than_one_default_group(tables, new_group):
    new_group.is_default = True
    new_group.save()

    another_group = Group(name='AnotherGroup')
    another_group.is_default = True
    another_group.save()

    defaults = Group.get_default_groups()
    assert new_group in defaults
    assert another_group in defaults
def test_get_default_without_default_group(tables, new_group):
    new_group.save()

    assert len(Group.get_default_groups()) == 0
def test_marking_group_as_a_default(tables, new_group):
    new_group.is_default = True
    new_group.save()

    assert Group.get(new_group.id).is_default
    assert new_group in Group.get_default_groups()
def test_get_default_group(tables, new_group):
    new_group.is_default = True
    new_group.save()

    assert new_group in Group.get_default_groups()
Exemple #5
0
def get(only_default: bool = False) -> Tuple[List[Any], HttpStatusCode]:
    if only_default:
        groups = Group.get_default_groups()
    else:
        groups = Group.all()
    return [group.as_dict() for group in groups], HTTPStatus.OK.value