-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation related permissions and self-selection, planning and design #65 #68
base: master
Are you sure you want to change the base?
Conversation
Creation of new command show_permissions Update of new checkboxes to use relatedperms
8c33162
to
e867644
Compare
Delete comment in gtpermissions Delete comment in apps.py
new chanhes and new test in API_test
Delete unnecesary comments in permissionsmanagement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some suggestions around Docstring, merge conflicts and some test naming conventions. Feel free to reject them if you think they are not relevant. Overall nice job done here Michael.
#this unit test verifies the error handling behavior of an API view in Django by making a request | ||
# to a dynamic URL with a specific resource_id value and ensuring that the view responds with a 404 status code | ||
# if the resource is not found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#this unit test verifies the error handling behavior of an API view in Django by making a request | |
# to a dynamic URL with a specific resource_id value and ensuring that the view responds with a 404 status code | |
# if the resource is not found. |
djgentelella/tests/API_test.py
Outdated
class ErrorHandlingAPITestCase(TestCase): | ||
def setUp(self): |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
djgentelella/tests/API_test.py
Outdated
#this unit test verifies that the update_related_permission function can correctly update | ||
# existing related permissions and properly handles the situation | ||
# where the related permission is not found in the list of existing permissions. | ||
|
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
djgentelella/tests/API_test.py
Outdated
# Otras propiedades necesarias | ||
) | ||
|
||
def test_retrieve_permission_related_detail(self): |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
djgentelella/tests/API_test.py
Outdated
class PermissionRelatedAPITest(TestCase): | ||
def setUp(self): | ||
self.client = APIClient() | ||
|
||
def test_retrieve_nonexistent_permission_related_detail(self): | ||
# Define un 'permission_id' que no existe en la base de datos | ||
nonexistent_permission_id = 9999 | ||
|
||
url = reverse('api_related_permissions_detail', kwargs={'permission_id': nonexistent_permission_id}) | ||
response = self.client.get(url) | ||
|
||
# Verifica que la respuesta tenga un código de estado 404 (Not Found) | ||
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND) |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
<!-- Botones de Vista, Edición y Eliminación (si el usuario tiene los permisos correspondientes) --> | ||
|
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
djgentelella/tests/API_test.py
Outdated
======= | ||
from djgentelella.models import PermissionRelated | ||
>>>>>>> nueva-rama |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
djgentelella/tests/API_test.py
Outdated
import unittest | ||
from django.test import TestCase | ||
from django.conf import settings | ||
<<<<<<< HEAD |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
djgentelella/tests/API_test.py
Outdated
from django.test import TestCase | ||
from django.conf import settings | ||
<<<<<<< HEAD | ||
from djgentelella.models import PermissionRelated # Reemplaza 'yourapp' con el nombre real de tu aplicación |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
djgentelella/tests/__init__.py
Outdated
@@ -3,3 +3,4 @@ | |||
from .StoryMap_Test import * | |||
from .TimeLine_Test import * | |||
from .Notification_Test import * | |||
from .API_test import* |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job!
In this case a reimplementation and editing of the permissions system that contains the Django Gentelella widgets program was performed. Among its main modifications is for example the ability to create, delete, add and edit permissions along with other related permissions, it should be noted that each permission can have multiple permissions, a single permission or may not even have any associated permissions. In addition it is important to emphasize that to achieve the above is made use of the Django API rest framework, so you can bring the data of the permissions that are within the administration of Django. Likewise at the graphical interface level, just select a user and then select the permission you want to add, once you choose and check the permission, other checkboxes related to that permission are displayed or a message is displayed indicating that there are no related permissions. Also within the modal in which these permissions are present, there is a third section that will be used as a means of help and information for the user who manipulates the permissions system of the program.
For more information you can consult: #65