Skip to content

Commit 1fcbe8b

Browse files
committed
make tests pass
1 parent 5672fc8 commit 1fcbe8b

File tree

6 files changed

+131
-169
lines changed

6 files changed

+131
-169
lines changed

intbot/core/bot/channel_router.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
@dataclass
1717
class DiscordChannel:
18-
channel_id: int
18+
channel_id: str
1919
channel_name: str
2020

2121

22-
dont_send_it = DiscordChannel(channel_id=0, channel_name="/dev/null")
22+
dont_send_it = DiscordChannel(channel_id="0", channel_name="/dev/null")
2323

2424

2525
class Channels:

intbot/core/endpoints/webhooks.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def internal_webhook_endpoint(request):
2121
wh = Webhook.objects.create(
2222
source="internal",
2323
content=json.loads(request.body),
24+
extra={},
2425
)
2526
process_webhook.enqueue(str(wh.uuid))
2627

@@ -58,6 +59,7 @@ def github_webhook_endpoint(request):
5859
meta=github_headers,
5960
signature=signature,
6061
content=json.loads(request.body),
62+
extra={},
6163
)
6264
process_webhook.enqueue(str(wh.uuid))
6365
return JsonResponse({"status": "ok"})

intbot/core/integrations/github.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ def as_discord_message(self):
7878
return f"[{self.title}]({self.url})"
7979

8080

81-
@dataclasses.dataclass
8281
class GithubDraftIssue(BaseModel):
8382
id: str
8483
title: str
@@ -122,9 +121,6 @@ def get_repository(self):
122121
class GithubProjectV2Item(GithubWebhook):
123122
# NOTE: This might be something for pydantic schemas in the future
124123

125-
def action(self):
126-
return self.content["action"]
127-
128124
def sender(self):
129125
sender = self.get_sender()
130126

@@ -200,7 +196,7 @@ def as_discord_message(self) -> str:
200196
return message(
201197
**{
202198
"sender": sender,
203-
"action": self.action(),
199+
"action": self.action,
204200
"details": details,
205201
}
206202
)
@@ -220,7 +216,7 @@ def prep_github_webhook(wh: Webhook):
220216
wh.save()
221217
return wh
222218

223-
raise ValueError(f"Event {event} not supported")
219+
raise ValueError(f"Event `{event}` not supported")
224220

225221

226222
# Should we have a separate GithubClient that encapsulates this?

intbot/tests/test_admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
def test_admin_for_webhooks_sanity_check(admin_client):
99
url = "/admin/core/webhook/"
10-
wh = Webhook.objects.create(content={})
10+
wh = Webhook.objects.create(content={}, extra={})
1111
assert wh.uuid
1212

1313
response = admin_client.get(url)

0 commit comments

Comments
 (0)