Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
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
42 changes: 17 additions & 25 deletions api/internal/tests/test_charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@

import pytest
from dateutil.relativedelta import relativedelta
from ddf import G
from django.test import TestCase, override_settings
from django.utils import timezone
from factory.faker import faker
from pytz import UTC
from rest_framework.exceptions import ValidationError
from rest_framework.reverse import reverse
from shared.django_apps.core.tests.factories import OwnerFactory, RepositoryFactory
from shared.django_apps.core.tests.factories import (
CommitFactory,
OwnerFactory,
RepositoryFactory,
)

from api.internal.chart.filters import apply_default_filters, apply_simple_filters
from api.internal.chart.helpers import (
Expand Down Expand Up @@ -84,8 +87,7 @@ def setup_commits(
ci_passed = True if meets_default_filters else False
deleted = False if meets_default_filters else True

G(
Commit,
CommitFactory(
repository=repo,
branch=branch,
timestamp=timestamp,
Expand Down Expand Up @@ -340,8 +342,7 @@ def test_apply_simple_filters_branch_filtering(self):

def test_annotate_commits_with_totals(self):
with_complexity_commitid = "i230tky2"
G(
Commit,
CommitFactory(
commitid=with_complexity_commitid,
totals={"n": 0, "h": 0, "p": 0, "m": 0, "c": 0, "C": 0, "N": 1},
)
Expand All @@ -361,8 +362,7 @@ def test_annotate_commits_with_totals(self):

def test_annotate_commit_with_totals_no_complexity_sets_ratio_to_None(self):
no_complexity_commitid = "sdfkjwepj42"
G(
Commit,
CommitFactory(
commitid=no_complexity_commitid,
totals={"n": 0, "h": 0, "p": 0, "m": 0, "c": 0, "C": 0, "N": 0},
)
Expand Down Expand Up @@ -524,22 +524,19 @@ def setUp(self):
self.repo4.repoid,
]
)
self.commit1 = G(
model=Commit,
self.commit1 = CommitFactory(
repository=self.repo1,
totals={"h": 100, "n": 120, "p": 10, "m": 10},
branch=self.repo1.branch,
state="complete",
)
self.commit2 = G(
model=Commit,
self.commit2 = CommitFactory(
repository=self.repo2,
totals={"h": 14, "n": 25, "p": 6, "m": 5},
branch=self.repo2.branch,
state="complete",
)
self.commit3 = G(
model=Commit,
self.commit3 = CommitFactory(
repository=self.repo3,
totals={"h": 14, "n": 25, "p": 6, "m": 5},
branch=self.repo3.branch,
Expand Down Expand Up @@ -751,21 +748,19 @@ def test_first_complete_commit_date_returns_date_of_first_complete_commit_in_rep
)
self.user.permission = [repo1.repoid, repo2.repoid]
self.user.save()
G(
model=Commit,
CommitFactory(
repository=repo1,
branch=repo1.branch,
state="pending",
timestamp=timezone.now() - timedelta(days=7),
)
commit1 = G(
model=Commit,
commit1 = CommitFactory(
repository=repo1,
branch=repo1.branch,
state="complete",
timestamp=timezone.now() - timedelta(days=3),
)
G(model=Commit, repository=repo2, branch=repo2.branch, state="complete")
CommitFactory(repository=repo2, branch=repo2.branch, state="complete")

qr = ChartQueryRunner(
self.user,
Expand Down Expand Up @@ -795,8 +790,7 @@ def test_start_date(self):
repo = RepositoryFactory(author=self.org, active=True)
self.user.permission = [repo.repoid]
self.user.save()
commit = G(
model=Commit,
commit = CommitFactory(
repository=repo,
branch=repo.branch,
state="complete",
Expand Down Expand Up @@ -957,15 +951,13 @@ def setUp(self):
self.current_owner = OwnerFactory(
permission=[self.repo1.repoid, self.repo2.repoid]
)
self.commit1 = G(
model=Commit,
self.commit1 = CommitFactory(
repository=self.repo1,
totals={"h": 100, "n": 120, "p": 10, "m": 10},
branch=self.repo1.branch,
state="complete",
)
self.commit2 = G(
model=Commit,
self.commit2 = CommitFactory(
repository=self.repo2,
totals={"h": 14, "n": 25, "p": 6, "m": 5},
branch=self.repo2.branch,
Expand Down
2 changes: 1 addition & 1 deletion api/public/v2/compare/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from distutils.util import strtobool
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import OpenApiParameter, extend_schema
from rest_framework import mixins
Expand All @@ -15,6 +14,7 @@
)
from services.components import ComponentComparison, commit_components
from services.decorators import torngit_safe
from utils import strtobool

from .serializers import ComparisonSerializer, ComponentComparisonSerializer

Expand Down
8 changes: 0 additions & 8 deletions codecov/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,5 @@
from utils.config import get_settings_module

os.environ.setdefault("DJANGO_SETTINGS_MODULE", get_settings_module())
if (
os.getenv("OPENTELEMETRY_ENDPOINT")
and os.getenv("OPENTELEMETRY_TOKEN")
and os.getenv("OPENTELEMETRY_CODECOV_RATE")
):
from open_telemetry import instrument

instrument()

application = get_wsgi_application()
5 changes: 2 additions & 3 deletions codecov_auth/views/bitbucket_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import threading
from urllib.parse import urlencode

import oauth2 as oauth
from asgiref.sync import async_to_sync
from django.conf import settings
from django.shortcuts import redirect
Expand All @@ -28,7 +27,7 @@ async def fetch_user_data(self, token):
key=settings.BITBUCKET_SERVER_CLIENT_ID,
secret=settings.BITBUCKET_SERVER_CLIENT_SECRET,
),
token=oauth.Token(token["key"], token["secret"]),
token=token,
)
# Whoami? Get the user
# https://answers.atlassian.com/questions/9379031/answers/9379803
Expand Down Expand Up @@ -103,7 +102,7 @@ async def actual_login_step(self, request):
cookie_key, cookie_secret = [
base64.b64decode(i).decode() for i in request_cookie.split("|")
]
token = oauth.Token(cookie_key, cookie_secret)
token = {"key": cookie_key, "secret": cookie_secret}
repo_service = BitbucketServer(
oauth_consumer_token=dict(
key=settings.BITBUCKET_SERVER_CLIENT_ID,
Expand Down
2 changes: 1 addition & 1 deletion graphql_api/types/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

from ariadne import ObjectType
from asgiref.sync import sync_to_async
from distutils.util import strtobool
from django.conf import settings
from graphql.type.definition import GraphQLResolveInfo

import services.self_hosted as self_hosted
from graphql_api.types.enums.enums import LoginProvider, SyncProvider
from utils import strtobool

config_bindable = ObjectType("Config")

Expand Down
191 changes: 0 additions & 191 deletions open_telemetry.py

This file was deleted.

Loading
Loading