Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rate Throttling #421

Merged
merged 3 commits into from
Oct 21, 2023
Merged

Rate Throttling #421

merged 3 commits into from
Oct 21, 2023

Conversation

sulabhkatila
Copy link
Contributor

Contributor checklist


Issue

Related issue

@netlify
Copy link

netlify bot commented Oct 8, 2023

Deploy Preview for activist-org canceled.

Name Link
🔨 Latest commit f7b1a6d
🔍 Latest deploy log https://app.netlify.com/sites/activist-org/deploys/6533d47d0fa4a9000894c3f3

@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2023

Thank you for the pull request!

The activist team will do our best to address your contribution as soon as we can. The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

If you're not already a member of our public Matrix community, please consider joining! We'd suggest using Element as your Matrix client, and definitely join the General and Development rooms once you're in. It'd be great to have you!

Maintainer checklist

  • The commit messages for the remote branch should be checked to make sure the contributor's email is set up correctly so that they receive credit for their contribution

    • The contributor's name and icon in remote commits should be the same as what appears in the PR
    • If there's a mismatch, the contributor needs to make sure that the email they use for GitHub matches what they have for git config user.email in their local activist repo
  • The TypeScript and formatting workflows within the PR checks do not indicate new errors in the files changed

  • The CHANGELOG has been updated with a description of the changes for the upcoming release (if necessary)

@andrewtavis
Copy link
Member

Thanks for this, @sulabhkatila! Will try to get to this review in the coming days 😊

@andrewtavis andrewtavis added the hacktoberfest-accepted Accepted as a part of Hacktoberfest label Oct 8, 2023
@to-sta to-sta mentioned this pull request Oct 10, 2023
2 tasks
@@ -1,3 +1,40 @@
from django.test import TestCase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick note @sulabhkatila: we also need to import override_settings here and in the other files :) I can get this for you post merge! 😊

@andrewtavis
Copy link
Member

@sulabhkatila, @to-sta and I are looking into this right now. Tests are running within the Docker backend, but we're getting errors on our end. We'll be in touch later :)

Copy link
Collaborator

@to-sta to-sta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewtavis i would suggest we only add the additons for the REST_FRAMEWORK dict. in settings.py for now and address the test in #432.

Comment on lines +101 to 110
},
"test": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "test_" + DATABASE_NAME,
"USER": DATABASE_USER,
"PASSWORD": DATABASE_PASSWORD,
"HOST": DATABASE_HOST,
"PORT": DATABASE_PORT,
},
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say for now, we do not need to explicitly create a test database, since Django does that by default. Here are the paragraphs from the docs:

Tests that require a database (namely, model tests) will not use your “real” (production) database. Separate, blank databases are created for the tests.
...
The default test database names are created by prepending test_ to the value of each NAME in DATABASES.

We might start with the TEST key inside the database. But we will address that in the issue #432.

@@ -44,6 +44,7 @@

INSTALLED_APPS = [
"rest_framework",
"rest_framework.authtoken",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this for user-based throttling? I think we can get rid of the authtoken and address this in a seperate issue.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say we address the tests in #432 rather than implementing them now. @sulabhkatila i have seen you put a lot of work in there 🚀 but there are still issues, that we might be able to address in a more standardize way with a thrid party package like factory_boy. For example when you create an object that has a foreign key you have to create the foreign key object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewtavis, @to-sta Thank you so much for your feedback. I will also do more research and see if I can make the needed changes to the tests.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sulabhkatila we will be merging your PR, without the tests for now. We will picking up the tests for Rate Throttling in another issue soon. You're welcome to work on it if you want 😃

Copy link
Member

@andrewtavis andrewtavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution here, @sulabhkatila! Appreciate you taking this on and attempting the tests as well :) We'll get to them in another issue, and as @to-sta said you'd be welcome to work on that 😊

@andrewtavis andrewtavis merged commit 001d38f into activist-org:main Oct 21, 2023
6 checks passed
This was referenced Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Accepted as a part of Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants