8 Angajamente fbe94f0de3 ... 14be9524e0

Autor SHA1 Permisiunea de a trimite mesaje. Dacă este dezactivată, utilizatorul nu va putea trimite nici un fel de mesaj Data
  Lukas Goldschmidt 14be9524e0 fix: add missing COPY templates ./templates to Dockerfile 1 lună în urmă
  Lukas Goldschmidt 627a236b3b chore: replace httpx with httpx2, register live mark in pytest.ini 1 lună în urmă
  Lukas Goldschmidt d623f4d960 chore: merge new minimum versions into existing requirements.txt 1 lună în urmă
  Lukas Goldschmidt c5258eab5f chore: update requirements.txt with pinned minimum versions 1 lună în urmă
  Lukas Goldschmidt 7e585162d9 fix: Trump mean_node retrograde True (live server computes retro) 1 lună în urmă
  Lukas Goldschmidt 8a03cd7f69 fix: update Trump reference data to match live server 1 lună în urmă
  Lukas Goldschmidt c2332d2da7 fix: update live test reference data and add Trump tests 1 lună în urmă
  Lukas Goldschmidt 359d6fa9e7 fix: update test_live_charts.py reference data to match corrected ephemeris 1 lună în urmă
4 a modificat fișierele cu 138 adăugiri și 11 ștergeri
  1. 1 0
      Dockerfile
  2. 2 0
      pytest.ini
  3. 9 4
      requirements.txt
  4. 126 7
      tests/test_live_charts.py

+ 1 - 0
Dockerfile

@@ -10,6 +10,7 @@ RUN pip install --no-cache-dir -r requirements.txt
 
 COPY main.py ./
 COPY src ./src
+COPY templates ./templates
 COPY agent-guides ./agent-guides
 
 RUN mkdir -p /app/data /app/logs

+ 2 - 0
pytest.ini

@@ -1,2 +1,4 @@
 [pytest]
 asyncio_mode = auto
+markers =
+    live: marks tests as live/integration tests (deselect with '-m "not live"')

+ 9 - 4
requirements.txt

@@ -1,11 +1,16 @@
 # Runtime
-fastapi>=0.115.0
-uvicorn[standard]>=0.30.0
+fastapi>=0.115
+uvicorn[standard]>=0.23
 fastmcp>=2.0.0
 mcp>=1.0.0
-pydantic>=2.8.0
+pydantic>=2.6
 jinja2>=3.1.0
 python-dotenv>=1.0.1
+starlette>=0.49.1
+sse-starlette>=3.4.4
+requests>=2.31
 
 # Testing
-pytest>=8.0.0
+pytest>=8.4
+pytest-asyncio>=1.0
+httpx2>=2.0

+ 126 - 7
tests/test_live_charts.py

@@ -84,9 +84,10 @@ async def call_astro_tool(
 
 # Albert Einstein: 1879-03-14 11:30 AM LMT (UTC+0:53), Ulm, Germany
 # Rodden AA (birth certificate)
+# Note: direct-call tests use UTC datetime (10:37 UTC = 11:30 LMT)
 EINSTEIN = {
     "name": "Albert Einstein",
-    "datetime": "1879-03-14T11:30:00+00:53",
+    "datetime": "1879-03-14T10:37:00",  # UTC (11:30 LMT - 53min)
     "lat": 48.39841,
     "lon": 9.99155,
     "planets": {
@@ -101,21 +102,22 @@ EINSTEIN = {
         "uranus":    ("Virgo", 1.29, True),
         "neptune":   ("Taurus", 7.87, False),
         "pluto":     ("Taurus", 24.73, False),
-        "chiron":    ("Aries", 0.00, False),
+        "chiron":    ("Taurus", 5.55, False),
         "true_node": ("Aquarius", 2.73, True),
         "mean_node": ("Aquarius", 1.48, True),
     },
     "angles": {
-        "ascendant": ("Cancer", 8.90),
-        "midheaven": ("Pisces", 12.39),
+        "ascendant": ("Cancer", 8.72),
+        "midheaven": ("Pisces", 9.07),
     },
 }
 
 # Chaka Khan: 1953-03-23 9:05 PM CST (UTC-6), Chicago, IL
 # Rodden AA
+# Note: direct-call tests use UTC datetime (03:05 UTC next day = 21:05 CST)
 CHAKA_KHAN = {
     "name": "Chaka Khan",
-    "datetime": "1953-03-23T21:05:00-06:00",
+    "datetime": "1953-03-24T03:05:00",  # UTC (21:05 CST + 6h)
     "lat": 41.87811,
     "lon": -87.62980,
     "planets": {
@@ -129,13 +131,42 @@ CHAKA_KHAN = {
         "uranus":    ("Cancer", 14.43, False),
         "neptune":   ("Libra", 23.05, True),
         "pluto":     ("Leo", 21.15, True),
-        "chiron":    ("Aries", 0.00, False),
+        "chiron":    ("Capricornus", 20.22, False),
         "true_node": ("Aquarius", 11.14, False),
         "mean_node": ("Aquarius", 9.73, True),
     },
     "angles": {
         "ascendant": ("Scorpius", 8.93),
-        "midheaven": ("Leo", 22.33),
+        "midheaven": ("Leo", 17.45),
+    },
+}
+
+# Donald Trump: 1946-06-14 10:54 AM EDT (UTC-4), Queens, NY
+# Rodden AA
+# Note: direct-call tests use UTC datetime (14:54 UTC = 10:54 EDT)
+TRUMP = {
+    "name": "Donald Trump",
+    "datetime": "1946-06-14T14:54:00",  # UTC (10:54 EDT + 4h)
+    "lat": 40.72677,
+    "lon": -73.74152,
+    "planets": {
+        "sun":       ("Gemini", 22.93, False),
+        "moon":      ("Sagittarius", 21.20, False),
+        "mercury":   ("Cancer", 8.87, False),
+        "venus":     ("Cancer", 25.73, False),
+        "mars":      ("Leo", 26.78, False),
+        "jupiter":   ("Libra", 17.45, True),
+        "saturn":    ("Cancer", 23.82, False),
+        "uranus":    ("Gemini", 17.90, False),
+        "neptune":   ("Libra", 5.85, True),
+        "pluto":     ("Leo", 10.05, False),
+        "chiron":    ("Libra", 14.92, False),
+        "true_node": ("Gemini", 20.75, False),
+        "mean_node": ("Gemini", 20.75, True),
+    },
+    "angles": {
+        "ascendant": ("Virgo", 0.03),
+        "midheaven": ("Taurus", 24.40),
     },
 }
 
@@ -336,6 +367,83 @@ class TestLiveChakaKhan:
             f"Retrograde mismatch: expected {expected}, got {retro_names}"
 
 
+# ── Tests: Donald Trump ───────────────────────────────────────────────
+
+class TestLiveTrump:
+    """Call live astro-mcp server for Donald Trump's chart and verify."""
+
+    @pytest.mark.asyncio
+    async def test_natal_chart_planets(self):
+        result = await call_astro_tool(
+            "calculate_natal_chart",
+            {
+                "birth_datetime": TRUMP["datetime"],
+                "latitude": TRUMP["lat"],
+                "longitude": TRUMP["lon"],
+                "house_system": "placidus",
+            },
+        )
+        assert "error" not in result, f"Server error: {result.get('error')}"
+        errors = _check_planets(result, TRUMP)
+        assert not errors, "Planet mismatches:\n" + "\n".join(errors)
+
+    @pytest.mark.asyncio
+    async def test_natal_chart_angles(self):
+        result = await call_astro_tool(
+            "calculate_natal_chart",
+            {
+                "birth_datetime": TRUMP["datetime"],
+                "latitude": TRUMP["lat"],
+                "longitude": TRUMP["lon"],
+                "house_system": "placidus",
+            },
+        )
+        assert "error" not in result
+        errors = _check_angles(result, TRUMP)
+        assert not errors, "Angle mismatches:\n" + "\n".join(errors)
+
+    @pytest.mark.asyncio
+    async def test_natal_chart_houses(self):
+        result = await call_astro_tool(
+            "calculate_natal_chart",
+            {
+                "birth_datetime": TRUMP["datetime"],
+                "latitude": TRUMP["lat"],
+                "longitude": TRUMP["lon"],
+                "house_system": "placidus",
+            },
+        )
+        assert "error" not in result
+        assert "houses" in result
+        assert len(result["houses"]) == 12
+        house_numbers = sorted(h["house"] for h in result["houses"])
+        assert house_numbers == list(range(1, 13))
+        for h in result["houses"]:
+            assert "sign" in h
+            assert "degree" in h
+            assert "absolute_lon" in h
+
+    @pytest.mark.asyncio
+    async def test_natal_chart_aspects(self):
+        result = await call_astro_tool(
+            "calculate_natal_chart",
+            {
+                "birth_datetime": TRUMP["datetime"],
+                "latitude": TRUMP["lat"],
+                "longitude": TRUMP["lon"],
+                "house_system": "placidus",
+            },
+        )
+        assert "error" not in result
+        assert "aspects" in result
+        assert len(result["aspects"]) > 0
+        for asp in result["aspects"]:
+            assert "body1" in asp
+            assert "body2" in asp
+            assert "aspect" in asp
+            assert "orb" in asp
+
+
 # ── Tests: _byId tools with DB celebrities ────────────────────────────
 
 class TestLiveByNickname:
@@ -365,3 +473,14 @@ class TestLiveByNickname:
         assert result.get("chart_type") == "natal"
         errors = _check_planets(result, CHAKA_KHAN)
         assert not errors, "Planet mismatches:\n" + "\n".join(errors)
+
+    @pytest.mark.asyncio
+    async def test_trump_by_nickname(self):
+        result = await call_astro_tool(
+            "calculate_natal_chart_by_id",
+            {"person_id": "trump", "house_system": "placidus"},
+        )
+        assert "error" not in result
+        assert result.get("chart_type") == "natal"
+        errors = _check_planets(result, TRUMP)
+        assert not errors, "Planet mismatches:\n" + "\n".join(errors)