-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 'fb-optic-1178/memory-leak'
- Loading branch information
Showing
17 changed files
with
172 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,13 @@ | |
|
||
import pytest | ||
from django.db.models.query import QuerySet | ||
from django.test import TestCase | ||
from django.urls import reverse | ||
from django.utils.http import urlencode | ||
from organizations.models import Organization | ||
from projects.models import Project | ||
from rest_framework.test import APIClient | ||
from tasks.models import Task | ||
from tests.utils import make_project | ||
from users.models import User | ||
|
||
|
@@ -40,3 +47,45 @@ def test_project_all_members(business_client): | |
|
||
assert isinstance(members, QuerySet) | ||
assert isinstance(members.first(), User) | ||
|
||
|
||
class TestProjectCountsListAPI(TestCase): | ||
@classmethod | ||
def setUpTestData(cls): | ||
cls.user = User.objects.create_user(username='testuser', email='[email protected]', password='testpassword') | ||
cls.organization = Organization.objects.create(title='testorganization') | ||
cls.user.active_organization = cls.organization | ||
cls.user.save() | ||
cls.project_1 = Project.objects.create(title='Project 1', organization=cls.organization) | ||
cls.project_2 = Project.objects.create(title='Project 2', organization=cls.organization) | ||
Task.objects.create(project=cls.project_1, data={'text': 'Task 1'}) | ||
Task.objects.create(project=cls.project_1, data={'text': 'Task 2'}) | ||
Task.objects.create(project=cls.project_2, data={'text': 'Task 3'}) | ||
|
||
def get_url(self, **params): | ||
return f'{reverse("projects:api:project-counts-list")}?{urlencode(params)}' | ||
|
||
def test_get_counts(self): | ||
|
||
client = APIClient() | ||
client.force_authenticate(user=self.user) | ||
response = client.get(self.get_url(include='id,task_number,finished_task_number,total_predictions_number')) | ||
self.assertEqual(response.status_code, 200) | ||
self.assertEqual(response.json()['count'], 2) | ||
self.assertEqual( | ||
response.json()['results'], | ||
[ | ||
{ | ||
'id': self.project_1.id, | ||
'task_number': 2, | ||
'finished_task_number': 0, | ||
'total_predictions_number': 0, | ||
}, | ||
{ | ||
'id': self.project_2.id, | ||
'task_number': 1, | ||
'finished_task_number': 0, | ||
'total_predictions_number': 0, | ||
}, | ||
], | ||
) |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"message": "chore: OPTIC-1337: Update tooltips (#6737)", | ||
"commit": "1747ab0387b57ca5eb91e31288f25e69ff905630", | ||
"date": "2024-12-11T13:08:10.000Z", | ||
"message": "fix: OPTIC-1418: Improve Organization Membership API usage to reduce latency (#6780)", | ||
"commit": "ca1da7a2dc34dfd512d3d1dd71bf722ef4019f66", | ||
"date": "2024-12-16T15:03:14.000Z", | ||
"branch": "develop" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"message": "chore: OPTIC-1337: Update tooltips (#6737)", | ||
"commit": "1747ab0387b57ca5eb91e31288f25e69ff905630", | ||
"date": "2024-12-11T13:08:10.000Z", | ||
"message": "fix: OPTIC-1418: Improve Organization Membership API usage to reduce latency (#6780)", | ||
"commit": "ca1da7a2dc34dfd512d3d1dd71bf722ef4019f66", | ||
"date": "2024-12-16T15:03:14.000Z", | ||
"branch": "develop" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"message": "chore: OPTIC-1337: Update tooltips (#6737)", | ||
"commit": "1747ab0387b57ca5eb91e31288f25e69ff905630", | ||
"date": "2024-12-11T13:08:10.000Z", | ||
"message": "fix: OPTIC-1418: Improve Organization Membership API usage to reduce latency (#6780)", | ||
"commit": "ca1da7a2dc34dfd512d3d1dd71bf722ef4019f66", | ||
"date": "2024-12-16T15:03:14.000Z", | ||
"branch": "develop" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters