client = <django.test.client.Client object at 0x7f45e5245518>
mailmap_admin = <User: mailmap-admin>, sort_direction = 'desc'
@pytest.mark.django_db(transaction=True, reset_sequences=True)
@pytest.mark.parametrize("sort_direction", ["asc", "desc"])
def test_mailmap_list_datatables_ordering(client, mailmap_admin, sort_direction):
client.force_login(mailmap_admin)
mailmaps = _create_mailmaps(client)
mailmaps_sorted = list(sorted(mailmaps, key=lambda d: d["display_name"]))
all_display_names = [mm["display_name"] for mm in mailmaps_sorted]
if sort_direction == "desc":
all_display_names = list(reversed(all_display_names))
for i in range(NB_MAILMAPS // MM_PER_PAGE):
url = reverse(
"profile-mailmap-list-datatables",
query_params={
"draw": i,
"length": MM_PER_PAGE,
"start": i * MM_PER_PAGE,
"order[0][column]": 2,
"order[0][dir]": sort_direction,
> "columns[2][name]": "display_name",
},
)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/auth/test_mailmap.py:320:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
viewname = 'profile-mailmap-list-datatables', url_args = None
query_params = {'columns[2][name]': 'display_name', 'draw': 0, 'length': 10, 'order[0][column]': 2, ...}
current_app = None, urlconf = None, request = None
def reverse(
viewname: str,
url_args: Optional[Dict[str, Any]] = None,
query_params: Optional[QueryParameters] = None,
current_app: Optional[str] = None,
urlconf: Optional[str] = None,
request: Optional[HttpRequest] = None,
) -> str:
"""An override of django reverse function supporting query parameters.
Args:
viewname: the name of the django view from which to compute a url
url_args: dictionary of url arguments indexed by their names
query_params: dictionary of query parameters to append to the
reversed url
current_app: the name of the django app tighten to the view
urlconf: url configuration module
request: build an absolute URI if provided
Returns:
str: the url of the requested view with processed arguments and
query parameters
"""
if url_args:
url_args = {k: v for k, v in url_args.items() if v is not None}
url = django_reverse(
viewname, urlconf=urlconf, kwargs=url_args, current_app=current_app
)
if query_params:
query_params_dict = {k: v for k, v in query_params.items() if v is not None}
if len(query_params_dict) > 0:
query_dict = QueryDict("", mutable=True)
for k in sorted(query_params_dict.keys()):
value = query_params_dict[k]
> assert isinstance(value, str)
E assert False
E + where False = isinstance(0, str)
.tox/py3/lib/python3.7/site-packages/swh/web/common/utils.py:104: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 25 2022, 4:46 PM