Skip to content

Commit

Permalink
dev: Swap Transaction Test case for Test Case in api/internal tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ajay-sentry authored Dec 27, 2024
1 parent d83d8d9 commit 4540a4c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
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):
class TestRepoProviderService(TransactionTestCase):
def setUp(self):
self.repo_gh = RepositoryFactory.create(
author__unencrypted_oauth_token="testaaft3ituvli790m1yajovjv5eg0r4j0264iw",
Expand Down

0 comments on commit 4540a4c

Please sign in to comment.