From bffb51357e0ec1bc101633db2fadd7151d5df5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Wed, 18 Dec 2019 09:11:34 +0200 Subject: [PATCH] Add desc to hc.api.schemas.check --- CHANGELOG.md | 1 + hc/api/schemas.py | 1 + hc/api/tests/test_update_check.py | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4686813..6d9e2c7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file. - Added JSON endpoint for Shields.io (#304) - Django 3.0 - `senddeletionnotices` command skips profiles with recent last_active_date +- The "Update Check" API call can update check's description (#311) ### Bug Fixes - Don't set CSRF cookie on first visit. Signup is exempt from CSRF protection diff --git a/hc/api/schemas.py b/hc/api/schemas.py index bdd99f3b..fd1a87da 100644 --- a/hc/api/schemas.py +++ b/hc/api/schemas.py @@ -2,6 +2,7 @@ check = { "type": "object", "properties": { "name": {"type": "string", "maxLength": 100}, + "desc": {"type": "string"}, "tags": {"type": "string", "maxLength": 500}, "timeout": {"type": "number", "minimum": 60, "maximum": 2592000}, "grace": {"type": "number", "minimum": 60, "maximum": 2592000}, diff --git a/hc/api/tests/test_update_check.py b/hc/api/tests/test_update_check.py index c6d78cc3..1e5076a8 100644 --- a/hc/api/tests/test_update_check.py +++ b/hc/api/tests/test_update_check.py @@ -164,3 +164,12 @@ class UpdateCheckTestCase(BaseTestCase): r = self.post(self.check.code, {"api_key": "X" * 32, "channels": None}) self.assertEqual(r.status_code, 400) + + def test_it_rejects_non_string_desc(self): + r = self.post( + self.check.code, {"api_key": "X" * 32, "desc": 123} + ) + + self.assertEqual(r.status_code, 400) + + self.check.refresh_from_db()