# -*- coding: utf-8 -*-
# type: ignore
from __future__ import annotations

import http

from django.test import Client
from django.urls import reverse


def test_ok(client: Client, settings):
    # When
    result = client.get(reverse('ui.meta.manifest_json'))

    # Then
    assert result.status_code == http.HTTPStatus.OK

    payload = result.json()
    assert payload['name'] == settings.SITE_TITLE
    assert payload['short_name'] == settings.SITE_SHORT_TITLE
    assert payload['start_url'] == f"http://testserver{reverse('ui.associations.browse')}"
    assert payload['share_target']['action'] == (
        f"http://testserver{reverse('ui.integrations.pwa.share_sheet')}"
    )
