eb8dbf66a1
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
80 lines
2.9 KiB
Python
80 lines
2.9 KiB
Python
"""Test e2e real del grupo hoppscotch contra un self-host VIVO.
|
|
|
|
NO corre en la suite normal (skip). Para ejecutarlo a mano contra la instancia
|
|
viva, quita temporalmente el skip y asegura:
|
|
- backend Hoppscotch en http://localhost:3170
|
|
- mailpit en http://localhost:8025
|
|
- una team collection real cuyo ID pongas en COLLECTION_ID abajo.
|
|
|
|
El flujo: login(admin@example.com) -> create_request -> list -> delete.
|
|
|
|
Nota: el backend de referencia exige `teamID` dentro de CreateTeamRequestInput,
|
|
asi que la create pasa `team_id=TEAM_ID`. Rellena COLLECTION_ID y TEAM_ID con
|
|
una team collection real (consultables via myTeams / rootCollectionsOfTeam).
|
|
Este flujo se valido con exito contra la instancia viva el 10/06/2026.
|
|
"""
|
|
|
|
import pytest
|
|
|
|
from infra.hoppscotch_login import hoppscotch_login
|
|
from infra.hoppscotch_create_request import hoppscotch_create_request
|
|
from infra.hoppscotch_list_requests import hoppscotch_list_requests
|
|
from infra.hoppscotch_delete_request import hoppscotch_delete_request
|
|
from infra.hoppscotch_run_request import hoppscotch_run_request
|
|
|
|
# Rellenar con IDs reales del self-host antes de correr.
|
|
TEAM_ID = "REPLACE_WITH_REAL_TEAM_ID"
|
|
COLLECTION_ID = "REPLACE_WITH_REAL_COLLECTION_ID"
|
|
|
|
|
|
@pytest.mark.skip(reason="e2e real contra self-host vivo, correr a mano")
|
|
def test_e2e_crud_request_real():
|
|
login = hoppscotch_login("admin@example.com")
|
|
assert login["status"] == "ok", login
|
|
|
|
token = login["access_token"]
|
|
|
|
created = hoppscotch_create_request(
|
|
COLLECTION_ID,
|
|
"GET",
|
|
"https://api.example.com/e2e-ping",
|
|
title="e2e ping",
|
|
team_id=TEAM_ID,
|
|
access_token=token,
|
|
)
|
|
assert created["status"] == "ok", created
|
|
req_id = created["id"]
|
|
|
|
listed = hoppscotch_list_requests(COLLECTION_ID, access_token=token)
|
|
assert listed["status"] == "ok", listed
|
|
assert any(r["id"] == req_id for r in listed["requests"])
|
|
|
|
deleted = hoppscotch_delete_request(req_id, access_token=token)
|
|
assert deleted["status"] == "ok", deleted
|
|
assert deleted["deleted"] == req_id
|
|
|
|
|
|
@pytest.mark.skip(reason="e2e real self-host vivo")
|
|
def test_e2e_run_request_aparece_en_user_history():
|
|
"""Ejecuta una request real y verifica que entra en el UserHistory.
|
|
|
|
login -> run_request GET <<baseURL>>/api/status -> status_code 200 +
|
|
recorded True. La entry debe verse en la pestana History de la GUI
|
|
(subscription userHistoryCreated). Validado contra la instancia viva.
|
|
"""
|
|
login = hoppscotch_login("admin@example.com")
|
|
assert login["status"] == "ok", login
|
|
token = login["access_token"]
|
|
|
|
result = hoppscotch_run_request(
|
|
"GET",
|
|
"<<baseURL>>/api/status",
|
|
title="Status (e2e)",
|
|
variables={"baseURL": "https://registry.organic-machine.com"},
|
|
access_token=token,
|
|
)
|
|
assert result["status"] == "ok", result
|
|
assert result["status_code"] == 200, result
|
|
assert result["recorded"] is True, result
|
|
assert result["history_id"], result
|