Skip to content

[WIP] Authorizables and authorization checks - #53

Open
dwhswenson wants to merge 1 commit into
mainfrom
authorization-check
Open

[WIP] Authorizables and authorization checks#53
dwhswenson wants to merge 1 commit into
mainfrom
authorization-check

Conversation

@dwhswenson

Copy link
Copy Markdown
Member

This will introduce a new task, which checks that all the authorization is working. This is likely to be an occasional source of errors in all the automated workflows, so it is worth creating an easy tool to check it.

The main idea here is to use a abstract mix-in on the three classes that have some sort of authorization (Bot, Inbox, and SMTP). Subclasses need to define a method that raises exceptions if authorization fails, or returns True if it succeeds. They also need to define which exception classes are expected as indicators of authorization failure.

The reason to pass the exception along instead of just returning False is that the exception will usually contain more information about the nature of the failure. This is probably something we want to report to the user.

Testing is going to be a bit tricky, I think, because I want this to actually be an integration test. We'll have to skip these in cases where the necessary environment variables aren't provided.

@codecov

codecov Bot commented Oct 20, 2023

Copy link
Copy Markdown

Codecov Report

Attention: 71 lines in your changes are missing coverage. Please review.

Comparison is base (cd85036) 34.55% compared to head (722a3ff) 34.79%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #53      +/-   ##
==========================================
+ Coverage   34.55%   34.79%   +0.24%     
==========================================
  Files          20       23       +3     
  Lines         848      957     +109     
==========================================
+ Hits          293      333      +40     
- Misses        555      624      +69     
Files Coverage Δ
ticgithub/tests/utils.py 87.50% <84.61%> (-12.50%) ⬇️
ticgithub/inbox.py 41.48% <57.14%> (+0.58%) ⬆️
ticgithub/tasks/task.py 41.17% <20.00%> (-1.25%) ⬇️
ticgithub/bot.py 40.57% <54.54%> (+0.57%) ⬆️
ticgithub/authorizable.py 35.29% <35.29%> (ø)
ticgithub/tests/test_bot.py 48.48% <48.48%> (ø)
ticgithub/tasks/authorization_check.py 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant