chore(): added async decision persistence
This commit is contained in:
@@ -54,6 +54,18 @@ class ChannelAPITest(TestCase):
|
||||
self.assertEqual(resp.status_code, 201)
|
||||
self.assertEqual(resp.json()["channel_type"], ChannelType.SMTP)
|
||||
|
||||
def test_create_telegram_channel_invalid_config(self) -> None:
|
||||
resp = self._create_channel(config={"bot_token": "tok"})
|
||||
self.assertEqual(resp.status_code, 422)
|
||||
|
||||
def test_create_smtp_channel_invalid_config(self) -> None:
|
||||
resp = self._create_channel(
|
||||
channel_type=ChannelType.SMTP,
|
||||
name="Email",
|
||||
config={},
|
||||
)
|
||||
self.assertEqual(resp.status_code, 422)
|
||||
|
||||
def test_list_channels(self) -> None:
|
||||
self._create_channel()
|
||||
resp = self.client.get(
|
||||
@@ -92,6 +104,17 @@ class ChannelAPITest(TestCase):
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
self.assertEqual(resp.json()["name"], "Updated")
|
||||
|
||||
def test_update_channel_invalid_config(self) -> None:
|
||||
create_resp = self._create_channel()
|
||||
ch_id = create_resp.json()["id"]
|
||||
resp = self.client.patch(
|
||||
reverse("api-1:update_channel", args=[ch_id]),
|
||||
data=json.dumps({"config": {"bot_token": "tok"}}),
|
||||
content_type="application/json",
|
||||
HTTP_AUTHORIZATION=self.auth,
|
||||
)
|
||||
self.assertEqual(resp.status_code, 422)
|
||||
|
||||
def test_delete_channel(self) -> None:
|
||||
create_resp = self._create_channel()
|
||||
ch_id = create_resp.json()["id"]
|
||||
|
||||
Reference in New Issue
Block a user