Fix: reverse error messages
parent
5ccb7a2702
commit
f675cea441
|
@ -99,19 +99,19 @@ def check_if_project_privacity_can_be_changed(project):
|
|||
if project.is_private:
|
||||
current_memberships = project.memberships.count()
|
||||
max_memberships = project.owner.max_memberships_public_projects
|
||||
error_members_exceeded = ERROR_MAX_PRIVATE_PROJECTS_MEMBERSHIPS
|
||||
error_members_exceeded = ERROR_MAX_PUBLIC_PROJECTS_MEMBERSHIPS
|
||||
|
||||
current_projects = project.owner.owned_projects.filter(is_private=False).count()
|
||||
max_projects = project.owner.max_public_projects
|
||||
error_project_exceeded = ERROR_MAX_PRIVATE_PROJECTS
|
||||
error_project_exceeded = ERROR_MAX_PUBLIC_PROJECTS
|
||||
else:
|
||||
current_memberships = project.memberships.count()
|
||||
max_memberships = project.owner.max_memberships_private_projects
|
||||
error_members_exceeded = ERROR_MAX_PUBLIC_PROJECTS_MEMBERSHIPS
|
||||
error_members_exceeded = ERROR_MAX_PRIVATE_PROJECTS_MEMBERSHIPS
|
||||
|
||||
current_projects = project.owner.owned_projects.filter(is_private=True).count()
|
||||
max_projects = project.owner.max_private_projects
|
||||
error_project_exceeded = ERROR_MAX_PUBLIC_PROJECTS
|
||||
error_project_exceeded = ERROR_MAX_PRIVATE_PROJECTS
|
||||
|
||||
if max_memberships is not None and current_memberships > max_memberships:
|
||||
return {'can_be_updated': False, 'reason': error_members_exceeded}
|
||||
|
|
|
@ -1447,7 +1447,7 @@ def test_private_project_cant_be_public_because_owner_doesnt_have_enought_slot_a
|
|||
project.owner.max_memberships_public_projects = 3
|
||||
|
||||
assert (check_if_project_privacity_can_be_changed(project) ==
|
||||
{'can_be_updated': False, 'reason': ERROR_MAX_PRIVATE_PROJECTS_MEMBERSHIPS})
|
||||
{'can_be_updated': False, 'reason': ERROR_MAX_PUBLIC_PROJECTS_MEMBERSHIPS})
|
||||
|
||||
|
||||
def test_private_project_cant_be_public_because_owner_doesnt_have_enought_slot(client):
|
||||
|
@ -1461,7 +1461,7 @@ def test_private_project_cant_be_public_because_owner_doesnt_have_enought_slot(c
|
|||
project.owner.max_memberships_public_projects = 6
|
||||
|
||||
assert (check_if_project_privacity_can_be_changed(project) ==
|
||||
{'can_be_updated': False, 'reason': ERROR_MAX_PRIVATE_PROJECTS})
|
||||
{'can_be_updated': False, 'reason': ERROR_MAX_PUBLIC_PROJECTS})
|
||||
|
||||
|
||||
def test_private_project_cant_be_public_because_too_much_members(client):
|
||||
|
@ -1475,7 +1475,7 @@ def test_private_project_cant_be_public_because_too_much_members(client):
|
|||
project.owner.max_memberships_public_projects = 3
|
||||
|
||||
assert (check_if_project_privacity_can_be_changed(project) ==
|
||||
{'can_be_updated': False, 'reason': ERROR_MAX_PRIVATE_PROJECTS_MEMBERSHIPS})
|
||||
{'can_be_updated': False, 'reason': ERROR_MAX_PUBLIC_PROJECTS_MEMBERSHIPS})
|
||||
|
||||
|
||||
def test_private_project_can_be_public_because_owner_has_enought_slot_and_project_has_enought_members(client):
|
||||
|
@ -1543,7 +1543,7 @@ def test_public_project_cant_be_private_because_owner_doesnt_have_enought_slot_a
|
|||
project.owner.max_memberships_private_projects = 3
|
||||
|
||||
assert (check_if_project_privacity_can_be_changed(project) ==
|
||||
{'can_be_updated': False, 'reason': ERROR_MAX_PUBLIC_PROJECTS_MEMBERSHIPS})
|
||||
{'can_be_updated': False, 'reason': ERROR_MAX_PRIVATE_PROJECTS_MEMBERSHIPS})
|
||||
|
||||
|
||||
def test_public_project_cant_be_private_because_owner_doesnt_have_enought_slot(client):
|
||||
|
@ -1557,7 +1557,7 @@ def test_public_project_cant_be_private_because_owner_doesnt_have_enought_slot(c
|
|||
project.owner.max_memberships_private_projects = 6
|
||||
|
||||
assert (check_if_project_privacity_can_be_changed(project) ==
|
||||
{'can_be_updated': False, 'reason': ERROR_MAX_PUBLIC_PROJECTS})
|
||||
{'can_be_updated': False, 'reason': ERROR_MAX_PRIVATE_PROJECTS})
|
||||
|
||||
|
||||
def test_public_project_cant_be_private_because_too_much_members(client):
|
||||
|
@ -1571,7 +1571,7 @@ def test_public_project_cant_be_private_because_too_much_members(client):
|
|||
project.owner.max_memberships_private_projects = 3
|
||||
|
||||
assert (check_if_project_privacity_can_be_changed(project) ==
|
||||
{'can_be_updated': False, 'reason': ERROR_MAX_PUBLIC_PROJECTS_MEMBERSHIPS})
|
||||
{'can_be_updated': False, 'reason': ERROR_MAX_PRIVATE_PROJECTS_MEMBERSHIPS})
|
||||
|
||||
|
||||
def test_public_project_can_be_private_because_owner_has_enought_slot_and_project_has_enought_members(client):
|
||||
|
|
Loading…
Reference in New Issue