Skip to content

Commit 2799811

Browse files
committed
make check
1 parent 7f7fdd7 commit 2799811

File tree

2 files changed

+68
-19
lines changed

2 files changed

+68
-19
lines changed

backend/tests/apps/owasp/management/commands/owasp_aggregate_contributions_test.py

Lines changed: 65 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ def mock_chapter(self):
5959
chapter.owasp_repository = mock.Mock()
6060
chapter.owasp_repository.id = 1
6161
# Fix Django ORM compatibility
62-
chapter.owasp_repository.resolve_expression = mock.Mock(return_value=chapter.owasp_repository)
62+
chapter.owasp_repository.resolve_expression = mock.Mock(
63+
return_value=chapter.owasp_repository
64+
)
6365
chapter.owasp_repository.get_source_expressions = mock.Mock(return_value=[])
6466
return chapter
6567

@@ -71,18 +73,20 @@ def mock_project(self):
7173
project.owasp_repository = mock.Mock()
7274
project.owasp_repository.id = 1
7375
# Fix Django ORM compatibility
74-
project.owasp_repository.resolve_expression = mock.Mock(return_value=project.owasp_repository)
76+
project.owasp_repository.resolve_expression = mock.Mock(
77+
return_value=project.owasp_repository
78+
)
7579
project.owasp_repository.get_source_expressions = mock.Mock(return_value=[])
76-
80+
7781
# Mock additional repositories
7882
additional_repo1 = mock.Mock(id=2)
7983
additional_repo1.resolve_expression = mock.Mock(return_value=additional_repo1)
8084
additional_repo1.get_source_expressions = mock.Mock(return_value=[])
81-
85+
8286
additional_repo2 = mock.Mock(id=3)
8387
additional_repo2.resolve_expression = mock.Mock(return_value=additional_repo2)
8488
additional_repo2.get_source_expressions = mock.Mock(return_value=[])
85-
89+
8690
project.repositories.all.return_value = [additional_repo1, additional_repo2]
8791
return project
8892

@@ -212,11 +216,20 @@ def test_aggregate_project_without_repositories(self, command, mock_project):
212216
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.Issue")
213217
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.PullRequest")
214218
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.Release")
215-
def test_handle_chapters_only(self, mock_release, mock_pr, mock_issue, mock_commit, mock_chapter_model, command, mock_chapter):
219+
def test_handle_chapters_only(
220+
self,
221+
mock_release,
222+
mock_pr,
223+
mock_issue,
224+
mock_commit,
225+
mock_chapter_model,
226+
command,
227+
mock_chapter,
228+
):
216229
"""Test command execution for chapters only."""
217230
mock_chapter_model.objects.filter.return_value = MockQuerySet([mock_chapter])
218231
mock_chapter_model.bulk_save = mock.Mock()
219-
232+
220233
# Mock ORM queries to return counts
221234
mock_commit.objects.filter.return_value.count.return_value = 5
222235
mock_issue.objects.filter.return_value.count.return_value = 3
@@ -238,11 +251,20 @@ def test_handle_chapters_only(self, mock_release, mock_pr, mock_issue, mock_comm
238251
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.Issue")
239252
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.PullRequest")
240253
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.Release")
241-
def test_handle_projects_only(self, mock_release, mock_pr, mock_issue, mock_commit, mock_project_model, command, mock_project):
254+
def test_handle_projects_only(
255+
self,
256+
mock_release,
257+
mock_pr,
258+
mock_issue,
259+
mock_commit,
260+
mock_project_model,
261+
command,
262+
mock_project,
263+
):
242264
"""Test command execution for projects only."""
243265
mock_project_model.objects.filter.return_value = MockQuerySet([mock_project])
244266
mock_project_model.bulk_save = mock.Mock()
245-
267+
246268
# Mock ORM queries to return counts
247269
mock_commit.objects.filter.return_value.count.return_value = 8
248270
mock_issue.objects.filter.return_value.count.return_value = 4
@@ -282,7 +304,7 @@ def test_handle_both_entities(
282304
mock_project_model.objects.filter.return_value = MockQuerySet([mock_project])
283305
mock_chapter_model.bulk_save = mock.Mock()
284306
mock_project_model.bulk_save = mock.Mock()
285-
307+
286308
# Mock ORM queries to return counts
287309
mock_commit.objects.filter.return_value.count.return_value = 5
288310
mock_issue.objects.filter.return_value.count.return_value = 3
@@ -311,11 +333,20 @@ def test_handle_both_entities(
311333
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.Issue")
312334
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.PullRequest")
313335
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.Release")
314-
def test_handle_with_specific_key(self, mock_release, mock_pr, mock_issue, mock_commit, mock_chapter_model, command, mock_chapter):
336+
def test_handle_with_specific_key(
337+
self,
338+
mock_release,
339+
mock_pr,
340+
mock_issue,
341+
mock_commit,
342+
mock_chapter_model,
343+
command,
344+
mock_chapter,
345+
):
315346
"""Test command execution with a specific entity key."""
316347
mock_chapter_model.objects.filter.return_value = MockQuerySet([mock_chapter])
317348
mock_chapter_model.bulk_save = mock.Mock()
318-
349+
319350
# Mock ORM queries to return counts
320351
mock_commit.objects.filter.return_value.count.return_value = 3
321352
mock_issue.objects.filter.return_value.count.return_value = 2
@@ -337,12 +368,21 @@ def test_handle_with_specific_key(self, mock_release, mock_pr, mock_issue, mock_
337368
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.Issue")
338369
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.PullRequest")
339370
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.Release")
340-
def test_handle_with_offset(self, mock_release, mock_pr, mock_issue, mock_commit, mock_chapter_model, command, mock_chapter):
371+
def test_handle_with_offset(
372+
self,
373+
mock_release,
374+
mock_pr,
375+
mock_issue,
376+
mock_commit,
377+
mock_chapter_model,
378+
command,
379+
mock_chapter,
380+
):
341381
"""Test command execution with offset parameter."""
342382
chapters = [mock_chapter, mock_chapter, mock_chapter]
343383
mock_chapter_model.objects.filter.return_value = MockQuerySet(chapters)
344384
mock_chapter_model.bulk_save = mock.Mock()
345-
385+
346386
# Mock ORM queries to return counts
347387
mock_commit.objects.filter.return_value.count.return_value = 1
348388
mock_issue.objects.filter.return_value.count.return_value = 1
@@ -365,11 +405,20 @@ def test_handle_with_offset(self, mock_release, mock_pr, mock_issue, mock_commit
365405
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.Issue")
366406
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.PullRequest")
367407
@mock.patch("apps.owasp.management.commands.owasp_aggregate_contributions.Release")
368-
def test_handle_custom_days(self, mock_release, mock_pr, mock_issue, mock_commit, mock_chapter_model, command, mock_chapter):
408+
def test_handle_custom_days(
409+
self,
410+
mock_release,
411+
mock_pr,
412+
mock_issue,
413+
mock_commit,
414+
mock_chapter_model,
415+
command,
416+
mock_chapter,
417+
):
369418
"""Test command execution with custom days parameter."""
370419
mock_chapter_model.objects.filter.return_value = MockQuerySet([mock_chapter])
371420
mock_chapter_model.bulk_save = mock.Mock()
372-
421+
373422
# Mock ORM queries to return counts
374423
mock_commit.objects.filter.return_value.count.return_value = 0
375424
mock_issue.objects.filter.return_value.count.return_value = 0

frontend/src/components/ContributionHeatmap.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ const generateHeatmapSeries = (
2222
contributionData
2323
)
2424
}
25-
25+
2626
const start = new Date(startDate)
2727
const end = new Date(endDate)
2828

29-
// Handle invalid dates by using default range
29+
// Handle invalid dates by using default range
3030
if (Number.isNaN(start.getTime()) || Number.isNaN(end.getTime())) {
3131
const defaultEnd = new Date()
3232
const defaultStart = new Date()
@@ -37,7 +37,7 @@ const generateHeatmapSeries = (
3737
contributionData
3838
)
3939
}
40-
40+
4141
// Handle invalid range by swapping dates
4242
if (start > end) {
4343
return generateHeatmapSeries(endDate, startDate, contributionData)

0 commit comments

Comments
 (0)