Repository: ucfopen/canvasapi

Issue:
Delete Group Pages
**What resource needs additional coverage?**
Page

**What endpoints need to be covered?**
[Delete page](https://canvas.instructure.com/doc/api/pages.html#method.wiki_pages_api.destroy)

We already have [`Page.delete()`](https://github.com/ucfopen/canvasapi/blob/develop/canvasapi/page.py#L10), but it only works for course pages. Modify `Page.delete` to use the `parent_type` and `parent_id` attributes of the `Page` class to allow for both course and group pages to be deleted.


Discussion:
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/ucfopen/canvasapi/pull/624?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ucfopen) Report
> Merging [#624](https://app.codecov.io/gh/ucfopen/canvasapi/pull/624?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ucfopen) (e2cf093) into [develop](https://app.codecov.io/gh/ucfopen/canvasapi/commit/4cfa8223c6b36a60731ad2190ba2017444b8a6db?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ucfopen) (4cfa822) will **not change** coverage.
> The diff coverage is `n/a`.

```diff
@@            Coverage Diff            @@
##           develop      #624   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           73        73           
  Lines         3732      3732           
=========================================
  Hits          3732      3732           
```


| [Impacted Files](https://app.codecov.io/gh/ucfopen/canvasapi/pull/624?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ucfopen) | Coverage Δ | |
|---|---|---|
| [canvasapi/page.py](https://app.codecov.io/gh/ucfopen/canvasapi/pull/624?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ucfopen#diff-Y2FudmFzYXBpL3BhZ2UucHk=) | `100.00% <ø> (ø)` | |

:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ucfopen)


Patch:
diff --git a/AUTHORS.md b/AUTHORS.md
index 3b38cd8..d8387ff 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -26,8 +26,9 @@ Patches and Suggestions
 - Bradford Lynch [@bradfordlynch](https://github.com/bradfordlynch)
 - Brian Bennett [@bennettscience](https://github.com/bennettscience)
 - Bruce Spang [@brucespang](https://github.com/brucespang)
-- Catherine Abbruzzese [@cat0698](https://github.com/cat0698))
+- Caitlin Fabian [@Caitlin-Fabian](https://github.com/Caitlin-Fabian)
 - Cameron Cuff [@ctcuff](https://github.com/ctcuff)
+- Catherine Abbruzzese [@cat0698](https://github.com/cat0698)
 - Craig Thompson [@craigdsthompson](https://github.com/craigdsthompson)
 - Dalton Durst [@UniversalSuperBox](https://github.com/UniversalSuperBox)
 - Damian Sweeney [@damianfs](https://github.com/damianfs)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1a1aad4..d0dcc18 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
 ### New Endpoint Coverage
 
 - New Quizzes
+- Delete Page in Groups (Thanks, [@Caitlin-Fabian](https://github.com/Caitlin-Fabian))
 
 ### General
 
diff --git a/canvasapi/page.py b/canvasapi/page.py
index e0840b8..207cc18 100644
--- a/canvasapi/page.py
+++ b/canvasapi/page.py
@@ -12,13 +12,17 @@ class Page(CanvasObject):
         Delete this page.
 
         :calls: `DELETE /api/v1/courses/:course_id/pages/:url \
-        <https://canvas.instructure.com/doc/api/pages.html#method.wiki_pages_api.destroy>`_
+            <https://canvas.instructure.com/doc/api/pages.html#method.wiki_pages_api.destroy>`_
+            or
+            `DELETE /api/v1/groups/:group_id/pages/:url \
+            <https://canvas.instructure.com/doc/api/pages.html#method.wiki_pages_api.destroy>`_
 
         :rtype: :class:`canvasapi.page.Page`
         """
+
         response = self._requester.request(
             "DELETE",
-            "courses/{}/pages/{}".format(self.course_id, self.url),
+            "{}s/{}/pages/{}".format(self.parent_type, self.parent_id, self.url),
             _kwargs=combine_kwargs(**kwargs),
         )
         return Page(self._requester, response.json())
@@ -51,7 +55,8 @@ class Page(CanvasObject):
 
         :calls: `GET /api/v1/groups/:group_id \
             <https://canvas.instructure.com/doc/api/groups.html#method.groups.show>`_
-            or :calls: `GET /api/v1/courses/:id \
+            or
+            `GET /api/v1/courses/:id \
             <https://canvas.instructure.com/doc/api/courses.html#method.courses.show>`_
 
         :rtype: :class:`canvasapi.group.Group` or :class:`canvasapi.course.Course`


Test patch:
diff --git a/tests/fixtures/page.json b/tests/fixtures/page.json
index dac500f..d98e712 100644
--- a/tests/fixtures/page.json
+++ b/tests/fixtures/page.json
@@ -1,116 +1,126 @@
 {
-	"get_page": {
-		"method": "GET",
-		"endpoint": "courses/1/pages/my-url",
-		"data": {
-			"id": 1,
-			"url": "my-url",
-			"title": "Awesome Page"
-		},
-		"status_code": 200
-	},
-	"edit": {
-		"method": "PUT",
-		"endpoint": "courses/1/pages/my-url",
-		"data": {
-			"id": 1,
-			"title": "New Page",
-			"url": "my-url"
-		},
-		"status_code": 200
-	},
-	"delete_page": {
-		"method": "DELETE",
-		"endpoint": "courses/1/pages/my-url",
-		"data": {
-			"id": 1,
-			"title": "Page To Be Deleted",
-			"url": "my-url"
-		},
-		"status_code": 200
-	},
-	"list_revisions": {
-		"method": "GET",
-		"endpoint": "courses/1/pages/my-url/revisions",
-		"data": [
-			{
-				"id": 1,
-				"title": "Revision 1"
-			},
-			{
-				"id": 2,
-				"title": "Revision 2"
-			}
-		],
-		"status_code": 200,
-		"headers": {
-			"Link": "<https://example.com/api/v1/courses/1/pages/my-url/revisions?page=2&per_page=2>; rel=\"next\""
-		}
-	},
-	"list_revisions2": {
-		"method": "GET",
-		"endpoint": "courses/1/pages/my-url/revisions?page=2&per_page=2",
-		"data": [
-			{
-				"id": 3,
-				"title": "Revision 3"
-			},
-			{
-				"id": 4,
-				"title": "Revision 4"
-			}
-		],
-		"status_code": 200
-	},
-	"latest_revision": {
-		"method": "GET",
-		"endpoint": "courses/1/pages/my-url/revisions/latest",
-		"data": {
-			"id": 1,
-			"title": "Latest Revision",
-			"url": "my-url"
-		},
-		"status_code": 200
-	},
-	"get_latest_rev_by_id": {
-		"method": "GET",
-		"endpoint": "courses/1/pages/my-url/revisions/2",
-		"data": {
-			"id": 2,
-			"updated_at": "2012-08-07T11:23:58-06:00",
-			"revision_id": 2,
-			"url": "my-url"
-		},
-		"status_code": 200
-	},
-	"get_latest_rev_by_id_group": {
-		"method": "GET",
-		"endpoint": "groups/1/pages/my-url/revisions/2",
-		"data": {
-			"id": 2,
-			"revision_id": 2,
-			"url": "my-url"
-		},
-		"status_code": 200
-	},
-	"revert_to_revision": {
-		"method": "POST",
-		"endpoint": "courses/1/pages/my-url/revisions/3",
-		"data": {
-			"id": 1,
-			"revision_id": 3,
-			"url": "my-url"
-		},
-		"status_code": 200
-	},
-	"revert_to_revision_group": {
-		"method": "POST",
-		"endpoint": "groups/1/pages/my-url/revisions/3",
-		"data": {
-			"id": 1,
-			"revision_id": 3,
-			"url": "my-url"
-		},
-		"status_code": 200
-	}
-}
\ No newline at end of file
+    "get_page": {
+        "method": "GET",
+        "endpoint": "courses/1/pages/my-url",
+        "data": {
+            "id": 1,
+            "url": "my-url",
+            "title": "Awesome Page"
+        },
+        "status_code": 200
+    },
+    "edit": {
+        "method": "PUT",
+        "endpoint": "courses/1/pages/my-url",
+        "data": {
+            "id": 1,
+            "title": "New Page",
+            "url": "my-url"
+        },
+        "status_code": 200
+    },
+    "delete_page_course": {
+        "method": "DELETE",
+        "endpoint": "courses/1/pages/my-url",
+        "data": {
+            "id": 1,
+            "title": "Page To Be Deleted",
+            "url": "my-url"
+        },
+        "status_code": 200
+    },
+    "delete_page_group": {
+        "method": "DELETE",
+        "endpoint": "groups/1/pages/my-url",
+        "data": {
+            "id": 1,
+            "title": "Page To Be Deleted",
+            "url": "my-url"
+        },
+        "status_code": 200
+    },
+    "list_revisions": {
+        "method": "GET",
+        "endpoint": "courses/1/pages/my-url/revisions",
+        "data": [
+            {
+                "id": 1,
+                "title": "Revision 1"
+            },
+            {
+                "id": 2,
+                "title": "Revision 2"
+            }
+        ],
+        "status_code": 200,
+        "headers": {
+            "Link": "<https://example.com/api/v1/courses/1/pages/my-url/revisions?page=2&per_page=2>; rel=\"next\""
+        }
+    },
+    "list_revisions2": {
+        "method": "GET",
+        "endpoint": "courses/1/pages/my-url/revisions?page=2&per_page=2",
+        "data": [
+            {
+                "id": 3,
+                "title": "Revision 3"
+            },
+            {
+                "id": 4,
+                "title": "Revision 4"
+            }
+        ],
+        "status_code": 200
+    },
+    "latest_revision": {
+        "method": "GET",
+        "endpoint": "courses/1/pages/my-url/revisions/latest",
+        "data": {
+            "id": 1,
+            "title": "Latest Revision",
+            "url": "my-url"
+        },
+        "status_code": 200
+    },
+    "get_latest_rev_by_id": {
+        "method": "GET",
+        "endpoint": "courses/1/pages/my-url/revisions/2",
+        "data": {
+            "id": 2,
+            "updated_at": "2012-08-07T11:23:58-06:00",
+            "revision_id": 2,
+            "url": "my-url"
+        },
+        "status_code": 200
+    },
+    "get_latest_rev_by_id_group": {
+        "method": "GET",
+        "endpoint": "groups/1/pages/my-url/revisions/2",
+        "data": {
+            "id": 2,
+            "revision_id": 2,
+            "url": "my-url"
+        },
+        "status_code": 200
+    },
+    "revert_to_revision": {
+        "method": "POST",
+        "endpoint": "courses/1/pages/my-url/revisions/3",
+        "data": {
+            "id": 1,
+            "revision_id": 3,
+            "url": "my-url"
+        },
+        "status_code": 200
+    },
+    "revert_to_revision_group": {
+        "method": "POST",
+        "endpoint": "groups/1/pages/my-url/revisions/3",
+        "data": {
+            "id": 1,
+            "revision_id": 3,
+            "url": "my-url"
+        },
+        "status_code": 200
+    }
+}
diff --git a/tests/test_page.py b/tests/test_page.py
index 01ac166..e1735cc 100644
--- a/tests/test_page.py
+++ b/tests/test_page.py
@@ -33,6 +33,7 @@ class TestPage(unittest.TestCase):
         string = str(self.page_course)
         self.assertIsInstance(string, str)
 
+    # edit()
     def test_edit(self, m):
         register_uris({"page": ["edit"]}, m)
 
@@ -43,14 +44,23 @@ class TestPage(unittest.TestCase):
         self.assertTrue(hasattr(self.page_course, "title"))
         self.assertEqual(self.page_course.title, new_title)
 
-    def test_delete(self, m):
-        register_uris({"page": ["delete_page"]}, m)
+    # delete()
+    def test_delete_course(self, m):
+        register_uris({"page": ["delete_page_course"]}, m)
 
         page = self.page_course
         deleted_page = page.delete()
 
         self.assertIsInstance(deleted_page, Page)
 
+    def test_delete_group(self, m):
+        register_uris({"page": ["delete_page_group"]}, m)
+
+        page = self.page_group
+        deleted_page = page.delete()
+
+        self.assertIsInstance(deleted_page, Page)
+
     # get_revisions()
     def test_get_revisions(self, m):
         register_uris({"page": ["list_revisions", "list_revisions2"]}, m)