0001-tests_authentic2-verify-calls-to-sleep-on-redeploy-4.patch
hobo/agent/authentic2/management/commands/hobo_deploy.py | ||
---|---|---|
1 | 1 |
import requests |
2 | 2 |
import logging |
3 | 3 |
import os |
4 |
import time |
|
4 |
from time import sleep |
|
5 | 5 |
import xml.etree.ElementTree as ET |
6 | 6 | |
7 | 7 |
from authentic2 import app_settings |
... | ... | |
233 | 233 |
break |
234 | 234 | |
235 | 235 |
# wait 5, 10, 20, 40, .. seconds |
236 |
time.sleep(self.backoff_factor * (2 ** retries))
|
|
236 |
sleep(self.backoff_factor * (2 ** retries)) |
|
237 | 237 |
retries += 1 |
238 | 238 | |
239 | 239 |
if provision_target_ous: |
tests_authentic/test_hobo_deploy.py | ||
---|---|---|
5 | 5 |
import shutil |
6 | 6 |
import json |
7 | 7 |
import mock |
8 |
import time |
|
8 | 9 | |
9 | 10 |
from requests import RequestException |
10 | 11 | |
... | ... | |
461 | 462 |
ou=provider.ou, service__isnull=True, |
462 | 463 |
name=u'Service état-civil').count() == 1 |
463 | 464 | |
465 |
with mock.patch('hobo.agent.authentic2.provisionning.notify_agents') as mock_notify, \ |
|
466 |
mock.patch('hobo.agent.authentic2.management.commands.hobo_deploy.sleep', wraps=time.sleep) as sleep_mock: |
|
467 |
call_command('hobo_deploy', redeploy=True) |
|
468 |
assert sleep_mock.call_count == 0 |
|
469 | ||
464 | 470 | |
465 | 471 |
def test_import_template(db, tenant_base): |
466 | 472 |
def listify(value): |
467 |
- |