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

dev: Swap Transaction Test case for Test Case in api/internal tests #1073

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions api/internal/tests/views/test_self_hosted_user_viewset.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unittest.mock import patch

from django.test import TransactionTestCase, override_settings
from django.test import TestCase, override_settings
from rest_framework.reverse import reverse
from shared.django_apps.core.tests.factories import OwnerFactory

Expand All @@ -10,15 +10,15 @@


@override_settings(IS_ENTERPRISE=True, ROOT_URLCONF="api.internal.enterprise_urls")
class UserViewsetUnauthenticatedTestCase(TransactionTestCase):
class UserViewsetUnauthenticatedTestCase(TestCase):
def test_list_users(self):
res = self.client.get(reverse("selfhosted-users-list"))
# not authenticated
assert res.status_code == 401


@override_settings(IS_ENTERPRISE=True, ROOT_URLCONF="api.internal.enterprise_urls")
class UserViewsetTestCase(TransactionTestCase):
class UserViewsetTestCase(TestCase):
def setUp(self):
self.owner = OwnerFactory()
self.current_owner = OwnerFactory(organizations=[self.owner.ownerid])
Expand Down
4 changes: 2 additions & 2 deletions api/internal/tests/views/test_user_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from rest_framework import status
from rest_framework.reverse import reverse
from rest_framework.test import APITransactionTestCase
from rest_framework.test import APITestCase
from shared.django_apps.core.tests.factories import (
OwnerFactory,
PullFactory,
Expand All @@ -14,7 +14,7 @@
from utils.test_utils import APIClient


class UserViewSetTests(APITransactionTestCase):
class UserViewSetTests(APITestCase):
def setUp(self):
non_org_active_user = OwnerFactory()
self.current_owner = OwnerFactory(
Expand Down
4 changes: 2 additions & 2 deletions codecov/tests/base_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import json

from django.conf import settings
from django.test import TransactionTestCase
from django.test import TestCase


class InternalAPITest(TransactionTestCase):
class InternalAPITest(TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down
4 changes: 2 additions & 2 deletions services/tests/test_repo_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

import pytest
from django.conf import settings
from django.test import TransactionTestCase
from shared.django_apps.core.tests.factories import OwnerFactory, RepositoryFactory
from shared.torngit import Bitbucket, Github, Gitlab

from codecov.db import sync_to_async
from codecov.tests.base_test import InternalAPITest
from codecov_auth.models import (
GITHUB_APP_INSTALLATION_DEFAULT_NAME,
GithubAppInstallation,
Expand Down Expand Up @@ -114,7 +114,7 @@ def test_token_refresh_callback_none_cases(should_have_owner, service, db):
assert get_token_refresh_callback(owner, service) is None


class TestRepoProviderService(InternalAPITest):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

keeping this one as is due to test failures when not using TransactionTestCase

class TestRepoProviderService(TransactionTestCase):
def setUp(self):
self.repo_gh = RepositoryFactory.create(
author__unencrypted_oauth_token="testaaft3ituvli790m1yajovjv5eg0r4j0264iw",
Expand Down
Loading