"""HTTP-level checks for the integration endpoints (RIMS / REP / SME-Hub)."""

from __future__ import annotations

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


@pytest.mark.django_db
def test_rims_ingest_requires_permission(submitter_user, public_collection):
    client = Client()
    client.login(email="submitter@test.example", password="pw-test-1234")
    resp = client.post(reverse("repo_integration:rims_ingest"), data={})
    assert resp.status_code in (400, 403)


@pytest.mark.django_db
def test_oer_search_endpoint_returns_published_only(public_collection):
    client = Client()
    resp = client.get(reverse("repo_integration:oer_search"))
    # IsAuthenticated permission — anonymous gets 401/403.
    assert resp.status_code in (401, 403)
