-
-
Notifications
You must be signed in to change notification settings - Fork 103
Added Project Page Sorting #552
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
Merged
+859
−10
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b5ea0f1
implemented sortBy component
Rajgupta36 07aa6be
fixes
Rajgupta36 4eebb28
Merge branch 'main' into sort_algolia
kasya e42d95d
Merge branch 'main' into sort_algolia
kasya 43f049d
fixes
Rajgupta36 febce31
added query string syncing
Rajgupta36 5559cca
updated backend/cmd/algolia-update-replicas test case
Rajgupta36 84f0f60
updated icon & animation
Rajgupta36 a63518c
Merge branch 'main' into sort_algolia
Rajgupta36 2a5694a
pre-commit
Rajgupta36 8aa1c9a
Rename sortingoptions.ts to sortingOptions.ts
Rajgupta36 c4439eb
Merge branch 'main' into sort_algolia
arkid15r File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
14 changes: 14 additions & 0 deletions
14
backend/apps/common/management/commands/algolia_update_replicas.py
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"""A command to update OWASP Nest index replicas.""" | ||
|
||
from django.core.management.base import BaseCommand | ||
|
||
from apps.owasp.index.project import ProjectIndex | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Update OWASP Nest index replicas." | ||
|
||
def handle(self, *_args, **_options): | ||
print("\n Starting replica configuration...") | ||
ProjectIndex.configure_replicas() | ||
print("\n Replica have been Successfully created.") |
This file contains hidden or 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
43 changes: 43 additions & 0 deletions
43
backend/tests/common/management/commands/algolia_update_replicas_tests.py
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""Test cases for the algolia_update_replicas command.""" | ||
|
||
from io import StringIO | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
from algoliasearch.http.exceptions import AlgoliaException | ||
from django.core.management import call_command | ||
|
||
|
||
class TestUpdateReplicasCommand: | ||
"""Test cases for the algolia_update_replicas command.""" | ||
|
||
@pytest.fixture(autouse=True) | ||
def _setup(self): | ||
"""Set up test environment.""" | ||
self.stdout = StringIO() | ||
with patch("apps.owasp.index.project.ProjectIndex.configure_replicas") as replica_patch: | ||
self.mock_replica_update = replica_patch | ||
yield | ||
|
||
def test_successful_replica_configuration(self): | ||
"""Test successful replica configuration.""" | ||
with patch("sys.stdout", new=StringIO()) as fake_out: | ||
call_command("algolia_update_replicas") | ||
|
||
expected_output = ( | ||
"\n Starting replica configuration...\n" | ||
"\n Replica have been Successfully created.\n" | ||
) | ||
assert fake_out.getvalue() == expected_output | ||
self.mock_replica_update.assert_called_once() | ||
|
||
def test_handle_exception(self): | ||
"""Test handling of exceptions during replica configuration.""" | ||
error_message = "Failed to configure replicas" | ||
self.mock_replica_update.side_effect = AlgoliaException(error_message) | ||
|
||
with pytest.raises(AlgoliaException) as exc_info: | ||
call_command("algolia_update_replicas") | ||
|
||
assert str(exc_info.value) == error_message | ||
self.mock_replica_update.assert_called_once() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.