Skip to content

Tests: set provider explicitly #11342

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
May 22, 2024
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
17 changes: 13 additions & 4 deletions readthedocs/rtd_tests/tests/test_project_forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest import mock

from allauth.socialaccount.models import SocialAccount
from allauth.socialaccount.providers.github.provider import GitHubProvider
from django.contrib.auth.models import User
from django.core.exceptions import NON_FIELD_ERRORS
from django.test import TestCase
Expand Down Expand Up @@ -501,7 +502,9 @@ def setUp(self):
# User with connection
# User without connection
self.user_github = get(User)
self.social_github = get(SocialAccount, user=self.user_github)
self.social_github = get(
SocialAccount, user=self.user_github, provider=GitHubProvider.id
)
self.user_email = get(User)

def test_form_prevalidation_email_user(self):
Expand Down Expand Up @@ -537,11 +540,17 @@ def test_form_prevalidation_github_user(self):
class TestProjectPrevalidationFormsWithOrganizations(TestCase):
def setUp(self):
self.user_owner = get(User)
self.social_owner = get(SocialAccount, user=self.user_owner)
self.social_owner = get(
SocialAccount, user=self.user_owner, provider=GitHubProvider.id
)
self.user_admin = get(User)
self.social_admin = get(SocialAccount, user=self.user_admin)
self.social_admin = get(
SocialAccount, user=self.user_admin, provider=GitHubProvider.id
)
self.user_readonly = get(User)
self.social_readonly = get(SocialAccount, user=self.user_readonly)
self.social_readonly = get(
SocialAccount, user=self.user_readonly, provider=GitHubProvider.id
)

self.organization = get(
Organization,
Expand Down