From 25897a1aa17138f6733e09a3a8f5e4de2327edb4 Mon Sep 17 00:00:00 2001 From: Jon Benson Date: Sun, 6 Aug 2023 03:52:04 +0000 Subject: [PATCH 1/3] fix: Fixes Callling /control/parental/enable failing with `only content-type application/json is allowed` #795 --- src/adguardhome/parental.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adguardhome/parental.py b/src/adguardhome/parental.py index 3e6759b5..e2a7f18f 100644 --- a/src/adguardhome/parental.py +++ b/src/adguardhome/parental.py @@ -33,7 +33,7 @@ async def enable(self) -> None: """ try: await self.adguard.request( - "parental/enable", method="POST", data="sensitivity=TEEN" + "parental/enable", method="POST" ) except AdGuardHomeError as exception: raise AdGuardHomeError( From 272a8e7a02f70291f46547596203b8204746fe4f Mon Sep 17 00:00:00 2001 From: Jon Benson Date: Fri, 20 Oct 2023 21:37:27 +0000 Subject: [PATCH 2/3] fix: CI formatting and unit test --- src/adguardhome/parental.py | 4 +--- tests/test_parental.py | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/adguardhome/parental.py b/src/adguardhome/parental.py index e2a7f18f..f7db26ff 100644 --- a/src/adguardhome/parental.py +++ b/src/adguardhome/parental.py @@ -32,9 +32,7 @@ async def enable(self) -> None: AdGuardHomeError: If enabling parental control failed. """ try: - await self.adguard.request( - "parental/enable", method="POST" - ) + await self.adguard.request("parental/enable", method="POST") except AdGuardHomeError as exception: raise AdGuardHomeError( "Enabling AdGuard Home parental control failed" diff --git a/tests/test_parental.py b/tests/test_parental.py index 2c02c399..9aed78eb 100644 --- a/tests/test_parental.py +++ b/tests/test_parental.py @@ -43,8 +43,6 @@ async def test_enable(aresponses): # Handle to run asserts on request in async def response_handler(request): """Response handler for this test.""" - data = await request.text() - assert data == "sensitivity=TEEN" return aresponses.Response(status=200, text="OK") aresponses.add( From 5f3087b3497ea838f29f4fd3e8a330c35912ece0 Mon Sep 17 00:00:00 2001 From: Jon Benson Date: Mon, 23 Oct 2023 04:20:07 +0000 Subject: [PATCH 3/3] fix: Fix pylint error --- tests/test_parental.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_parental.py b/tests/test_parental.py index 9aed78eb..69e71c9e 100644 --- a/tests/test_parental.py +++ b/tests/test_parental.py @@ -41,12 +41,11 @@ async def test_enabled(aresponses): async def test_enable(aresponses): """Test enabling AdGuard Home parental control.""" # Handle to run asserts on request in - async def response_handler(request): - """Response handler for this test.""" - return aresponses.Response(status=200, text="OK") - aresponses.add( - "example.com:3000", "/control/parental/enable", "POST", response_handler + "example.com:3000", + "/control/parental/enable", + "POST", + aresponses.Response(status=200, text="OK"), ) aresponses.add( "example.com:3000",