Skip to content

Domains: test tasks with organizations #9541

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

Merged
merged 1 commit into from
Aug 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions readthedocs/domains/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from django_dynamic_fixture import get

from readthedocs.domains.tasks import email_pending_custom_domains
from readthedocs.organizations.models import Organization, Team
from readthedocs.projects.constants import (
SSL_STATUS_INVALID,
SSL_STATUS_PENDING,
Expand Down Expand Up @@ -119,3 +120,28 @@ def test_send_email_on_given_days(self, send_email):
kwargs = send_email.call_args_list[2][1]
self.assertEqual(kwargs["recipient"], self.another_user.email)
self.assertIn(self.domain_invalid.domain, kwargs["context"]["content"])


@override_settings(RTD_ALLOW_ORGANIZATIONS=True)
class TestTasksWithOrganizations(TestTasks):
def setUp(self):
super().setUp()
self.organization = get(
Organization,
owners=[self.user],
projects=[self.project, self.another_project],
)
self.team_a = get(
Team,
organization=self.organization,
members=[self.user],
projects=[self.project, self.another_project],
access="admin",
)
self.team_b = get(
Team,
organization=self.organization,
members=[self.user, self.another_user],
projects=[self.another_project],
access="admin",
)