Skip to content

Commit

Permalink
Fix E2E tests (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLamb authored Jul 26, 2023
1 parent 59b860b commit e4ed862
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 54 deletions.
6 changes: 4 additions & 2 deletions src/extended_search/apps.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from django.apps import AppConfig
from django.conf import settings


class ExtendedSearchConfig(AppConfig):
name = "extended_search"

def ready(self):
from extended_search.settings import extended_search_settings as search_settings
import extended_search.signals # noqa
from extended_search.settings import extended_search_settings as search_settings

search_settings.initialise_field_dict()
search_settings.initialise_env_dict()
search_settings.initialise_db_dict()
if settings.APP_ENV != "test":
search_settings.initialise_db_dict()
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import pytest

import unittest

from extended_search.fields import (
AbstractBaseField,
BaseIndexedField,
Expand Down Expand Up @@ -81,10 +79,10 @@ def test_init_params_accepted_defaults_and_all_saved_as_kwargs(self):
assert field.name == "foo"
assert field.model_field_name == field.name
assert field.boost == 1.0
assert field.search == False
assert field.autocomplete == False
assert field.filter == False
assert field.fuzzy == False
assert not field.search
assert not field.autocomplete
assert not field.filter
assert not field.fuzzy

field = BaseIndexedField(
"foo", search=True, autocomplete=True, filter=True, fuzzy=True
Expand All @@ -98,16 +96,16 @@ def test_init_params_accepted_defaults_and_all_saved_as_kwargs(self):
"filter": True,
"fuzzy": True,
} == field.kwargs
assert field.search == True
assert field.autocomplete == True
assert field.filter == True
assert field.fuzzy == True
assert field.search
assert field.autocomplete
assert field.filter
assert field.fuzzy

field = BaseIndexedField("foo", fuzzy=True)
assert field.search == True
assert field.autocomplete == False
assert field.filter == False
assert field.fuzzy == True
assert field.search
assert not field.autocomplete
assert not field.filter
assert field.fuzzy

def test_get_search_mapping_object_format(self):
field = BaseIndexedField("foo")
Expand Down Expand Up @@ -202,14 +200,14 @@ def test_init_params_accepted_defaults_and_all_saved_as_kwargs(self):
assert field.name == "foo"
assert field.model_field_name == field.name
assert field.boost == 1.0
assert field.search == False
assert field.autocomplete == False
assert field.filter == False
assert field.fuzzy == False
assert field.tokenized == False
assert field.explicit == False
assert field.keyword == False
assert field.proximity == False
assert not field.search
assert not field.autocomplete
assert not field.filter
assert not field.fuzzy
assert not field.tokenized
assert not field.explicit
assert not field.keyword
assert not field.proximity

field = IndexedField(
"foo",
Expand All @@ -232,39 +230,39 @@ def test_init_params_accepted_defaults_and_all_saved_as_kwargs(self):
"keyword": True,
"proximity": True,
} == field.kwargs
assert field.tokenized == True
assert field.explicit == True
assert field.keyword == True
assert field.proximity == True
assert field.tokenized
assert field.explicit
assert field.keyword
assert field.proximity

def test_init_params_set_search_param_when_needed(self):
field = IndexedField("foo", tokenized=True)
assert field.search == True
assert field.tokenized == True
assert field.explicit == False
assert field.keyword == False
assert field.proximity == False
assert field.search
assert field.tokenized
assert not field.explicit
assert not field.keyword
assert not field.proximity

field = IndexedField("foo", explicit=True)
assert field.search == True
assert field.explicit == True
assert field.tokenized == False
assert field.keyword == False
assert field.proximity == False
assert field.search
assert field.explicit
assert not field.tokenized
assert not field.keyword
assert not field.proximity

field = IndexedField("foo", keyword=True)
assert field.search == True
assert field.keyword == True
assert field.tokenized == False
assert field.explicit == False
assert field.proximity == False
assert field.search
assert field.keyword
assert not field.tokenized
assert not field.explicit
assert not field.proximity

field = IndexedField("foo", proximity=True)
assert field.search == False
assert field.proximity == True
assert field.tokenized == False
assert field.explicit == False
assert field.keyword == False
assert not field.search
assert field.proximity
assert not field.tokenized
assert not field.explicit
assert not field.keyword

def test_get_search_mapping_object_format(self):
field = IndexedField("foo", tokenized=True)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest

from extended_search.managers.query_builder import QueryBuilder

from extended_search.managers.query_builder import QueryBuilder # noqa

pytestmark = pytest.mark.xfail

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import pytest
from django.db import models
from wagtail.search import index

from extended_search.index import (
SearchField,
RelatedFields,
AutocompleteField,
RelatedFields,
RenamedFieldMixin,
SearchField,
)


Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit e4ed862

Please sign in to comment.