Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

fixed email string #100

Merged
merged 1 commit into from
Sep 2, 2024
Merged

Conversation

DonHaul
Copy link
Contributor

@DonHaul DonHaul commented Aug 27, 2024

No description provided.

@DonHaul DonHaul force-pushed the search-improvement-simple branch 4 times, most recently from 638f1e2 to c3af9d5 Compare August 29, 2024 09:03
@DonHaul DonHaul marked this pull request as ready for review August 29, 2024 09:03
@DonHaul
Copy link
Contributor Author

DonHaul commented Aug 29, 2024

Fix in another PR https://github.com/inspirehep/backoffice/pull/104/files
Added tests to make sure it exists

assert len(results) == 1
assert results[0]["data"]["name"]["value"] == "Smith, John"

def test_search_data_email(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytest has the feature called parametrize for this kind of cases exactly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought because it was a single test case this was not needed.

Django uses unittest in his classes which means parametrize is not supported: https://docs.pytest.org/en/latest/how-to/unittest.html#pytest-features-in-unittest-testcase-subclasses

Using parametrized to implement it

@DonHaul DonHaul force-pushed the search-improvement-simple branch from c3af9d5 to 7054db5 Compare August 30, 2024 12:10
@@ -11,6 +11,7 @@
from django.test import TransactionTestCase
from django.urls import reverse
from django_opensearch_dsl.registries import registry
from parameterized import parameterized
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we need to install it?

assert len(results) == 1
assert results[0]["data"]["name"]["value"] == "Smith, John"

@parameterized.expand(("[email protected]",))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for urls :) we are testing multiple urls

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay makes sense

@DonHaul DonHaul force-pushed the search-improvement-simple branch 2 times, most recently from d1c7bed to 0f587d0 Compare August 30, 2024 12:27
@@ -150,6 +150,7 @@ opensearch-py = "2.6.0"
djangorestframework-simplejwt = "^5.3.1"
django-json-widget = "^2.0.1"
sentry-sdk = "1.19.1"
parameterized = "^0.9.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we please add it in the dev deps?

@DonHaul DonHaul force-pushed the search-improvement-simple branch from 0f587d0 to 8648a6b Compare August 30, 2024 13:35
@DonHaul DonHaul merged commit 330505d into inspirehep:main Sep 2, 2024
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants