-
Notifications
You must be signed in to change notification settings - Fork 4
Conversation
638f1e2
to
c3af9d5
Compare
Fix in another PR https://github.com/inspirehep/backoffice/pull/104/files |
assert len(results) == 1 | ||
assert results[0]["data"]["name"]["value"] == "Smith, John" | ||
|
||
def test_search_data_email(self): |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
c3af9d5
to
7054db5
Compare
@@ -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 |
There was a problem hiding this comment.
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]",)) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay makes sense
d1c7bed
to
0f587d0
Compare
backoffice/pyproject.toml
Outdated
@@ -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" |
There was a problem hiding this comment.
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?
0f587d0
to
8648a6b
Compare
No description provided.