Repository: fossasia/open-event-server

Issue:
Adding dredd tests for panel permission
**Is your feature request related to a problem? Please describe.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
Add dredd tests for panel persmission
**Describe the solution you'd like**
<!-- A clear and concise description of what you want to happen. -->

**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->

**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
I'm working on it!


Discussion:
@prabhupant Ideally, the case for issues with parent issue is to:

- Link the parent issue in child issue
- Only create child issues when the PR is read to be sent

Second point is necessary, or else the issue tracker will be flooded with child issues with no PR
@iamareebjamal ok. I am sending the PR right now

Resolving patch:
diff --git a/app/factories/panel_permission.py b/app/factories/panel_permission.py
--- a/app/factories/panel_permission.py
+++ b/app/factories/panel_permission.py
@@ -10,5 +10,4 @@ class Meta:
         sqlalchemy_session = db.session
 
     panel_name = common.string_
-    custom_system_role = common.string_
     can_access = True


Test patch:
diff --git a/tests/hook_main.py b/tests/hook_main.py
--- a/tests/hook_main.py
+++ b/tests/hook_main.py
@@ -4241,3 +4241,86 @@ def custom_system_roles_panel_permission(transaction):
         panel_permission = PanelPermissionFactory()
         db.session.add(panel_permission)
         db.session.commit()
+
+
+# ------------------------- Panel Permission -------------------------
+
+
+@hooks.before("Panel Permissions > Panel Permissions Collection > List All Panel Permissions")
+def panel_permission_get_list(transaction):
+    """
+    GET /panel-permissions
+    :param transaction:
+    :return:
+    """
+    with stash['app'].app_context():
+        panel_permission = PanelPermissionFactory()
+        db.session.add(panel_permission)
+        db.session.commit()
+
+
+@hooks.before("Panel Permissions > Panel Permissions Collection > Create Panel Permissions")
+def panel_permission_post(transaction):
+    """
+    POST /panel-permissions
+    :param transaction:
+    :return:
+    """
+    with stash['app'].app_context():
+        panel_permission = PanelPermissionFactory()
+        db.session.add(panel_permission)
+        db.session.commit()
+
+
+@hooks.before("Panel Permissions > Panel Permission Details > Get Details")
+def panel_permission_get_detail(transaction):
+    """
+    GET /panel-permissions/10
+    :param transaction:
+    :return:
+    """
+    with stash['app'].app_context():
+        panel_permission = PanelPermissionFactory()
+        db.session.add(panel_permission)
+        db.session.commit()
+
+
+@hooks.before("Panel Permissions > Panel Permission Details > Update Panel Permission")
+def panel_permission_patch(transaction):
+    """
+    PATCH /panel-permissions/10
+    :param transaction:
+    :return:
+    """
+    with stash['app'].app_context():
+        panel_permission = PanelPermissionFactory()
+        db.session.add(panel_permission)
+        db.session.commit()
+
+
+@hooks.before("Panel Permissions > Panel Permission Details > Delete Panel Permission")
+def panel_permission_delete(transaction):
+    """
+    DELETE /panel-permissions/10
+    :param transaction:
+    :return:
+    """
+    with stash['app'].app_context():
+        panel_permission = PanelPermissionFactory()
+        db.session.add(panel_permission)
+        db.session.commit()
+
+
+@hooks.before(
+    "Panel Permissions > Panel Permission Details for a Custom System Role > "
+    "Panel Permission Details for a Custom System Role")
+def panel_permissions_custom_system_role(transaction):
+    """
+    GET /custom-system-roles/1/panel-permissions
+    :param transaction:
+    :return:
+    """
+    with stash['app'].app_context():
+        panel_permission = PanelPermissionFactory()
+        db.session.add(panel_permission)
+        db.session.commit()
diff --git a/tests/unittests/api/helpers/test_files.py b/tests/unittests/api/helpers/test_files.py
--- a/tests/unittests/api/helpers/test_files.py
+++ b/tests/unittests/api/helpers/test_files.py
@@ -112,7 +112,7 @@ def test_create_save_resized_image(self):
         """Method to test create resized images"""
 
         with app.test_request_context():
-            image_url_test = 'https://cdn.pixabay.com/photo/2014/09/08/17/08/hot-air-balloons-439331_960_720.jpg'
+            image_url_test = 'https://cdn.pixabay.com/photo/2017/06/17/10/55/hot-air-balloon-2411851_1280.jpg'
             width = 500
             height = 200
             aspect_ratio = False
@@ -129,7 +129,7 @@ def test_create_save_image_sizes(self):
         """Method to test create image sizes"""
 
         with app.test_request_context():
-            image_url_test = 'https://cdn.pixabay.com/photo/2014/09/08/17/08/hot-air-balloons-439331_960_720.jpg'
+            image_url_test = 'https://cdn.pixabay.com/photo/2017/06/17/10/55/hot-air-balloon-2411851_1280.jpg'
             image_sizes_type = "event-image"
             width_large = 1300
             width_thumbnail = 500