Skip to content

Commit

Permalink
Merge pull request #691 from NamPNQ/fix/maiia-get-reasons
Browse files Browse the repository at this point in the history
fix(maiia): Fix get reasons pass wrong arg
  • Loading branch information
grubounet authored Oct 25, 2022
2 parents f63aae0 + 54ac318 commit d3ddf8c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scraper/maiia/maiia.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _fetch(self, request: ScraperRequest, creneau_q=DummyQueue()) -> Optional[st
return None
center_id = url_query["centerid"][0]

reasons = get_reasons(center_id, self._client, request=request)
reasons = get_reasons(center_id, client=self._client, request=request)
if not reasons:
return None
self.lieu = Lieu(
Expand Down
10 changes: 9 additions & 1 deletion tests/test_maiia.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import pytest
import logging
from urllib.parse import parse_qs
from scraper.pattern.center_info import CenterInfo
from utils.vmd_utils import DummyQueue
import httpx
Expand All @@ -25,6 +26,11 @@

def app(request: httpx.Request) -> httpx.Response:
try:
qs = parse_qs(
request.url._uri_reference.query
) # we dont access request.url.query because its return query.encode('ascii'), will crashed
if int(qs.get("page", ["0"])[0]) >= 1:
return httpx.Response(200, json={"items": [], "total": 0})
slug = request.url.path.split("/")[-1]
endpoint = slug.split("?")[0]
path = Path("tests", "fixtures", "maiia", f"{endpoint}.json")
Expand Down Expand Up @@ -128,7 +134,9 @@ def test_get_first_availability():
assert first_availability.isoformat() == "2021-05-13T13:40:00+00:00"


@pytest.mark.skip(reason="je n'ai aucune connaissance de ce scrapper et je dois supprimer les artifacts qui encombrent gitlab :D")
@pytest.mark.skip(
reason="je n'ai aucune connaissance de ce scrapper et je dois supprimer les artifacts qui encombrent gitlab :D"
)
def test_fetch_slots():

# Oops I forgot centerid
Expand Down

0 comments on commit d3ddf8c

Please sign in to comment.