Fix tests

This commit is contained in:
Thomas Sileo 2019-04-05 20:03:49 +02:00
parent 6e7bfdd5c1
commit 84997b564f
4 changed files with 6 additions and 5 deletions

3
app.py
View file

@ -88,7 +88,8 @@ from utils.media import Kind
from poussetaches import PousseTaches
p = PousseTaches("http://poussetaches:7991", "http://web:5005")
phost = "http://" + os.getenv("COMPOSE_PROJECT_NAME", "")
p = PousseTaches(f"{phost}_poussetaches_1:7991", f"{phost}_web_1:5005")
back = activitypub.MicroblogPubBackend()

View file

@ -9,8 +9,9 @@ services:
- "./static:/app/static"
environment:
- MICROBLOGPUB_AMQP_BROKER=pyamqp://guest@rmq//
- MICROBLOGPUB_MONGODB_HOST=mongo:27017
- MICROBLOGPUB_MONGODB_HOST=${COMPOSE_PROJECT_NAME}_mongo_1:27017
- MICROBLOGPUB_DEBUG=1
- COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME}
- POUSSETACHES_AUTH_KEY=123
celery:
# image: "instance1_web"

View file

@ -45,4 +45,4 @@ class PousseTaches:
print(f"envelope={envelope!r}")
payload = json.loads(base64.b64decode(envelope["payload"]))
return Task(req_id=envelope["req_id"], tries=envelope["tries"], payload=payload)
return Task(req_id=envelope["req_id"], tries=envelope["tries"], payload=payload) # type: ignore

View file

@ -19,7 +19,7 @@ class Instance(object):
def __init__(self, name, host_url, docker_url=None):
self.host_url = host_url
self.docker_url = docker_url or host_url
self._create_delay = 60
self._create_delay = 15
with open(
os.path.join(
os.path.dirname(os.path.abspath(__file__)),
@ -50,7 +50,6 @@ class Instance(object):
def debug(self):
"""Returns the debug infos (number of items in the inbox/outbox."""
time.sleep(self._create_delay)
resp = requests.get(
f"{self.host_url}/api/debug",
headers={**self._auth_headers, "Accept": "application/json"},