hobo/tests_passerelle/test_deploy.py

45 lines
1.3 KiB
Python

import json
import sys
from hobo.multitenant.middleware import TenantMiddleware
from django.core.management import call_command
import StringIO
def test_deploy_specifics(db, tenant_base):
hobo_json = {
'variables': {
'hobo_test_variable': True,
'other_variable': 'foo',
},
'services': [
{
'slug': 'test',
'title': 'Test',
'service-id': 'welco',
'this': True,
'secret_key': '12345',
'base_url': 'http://passerelle.example.net',
'saml-sp-metadata-url': 'http://passerelle.example.net/saml/metadata',
'variables': {
'other_variable': 'bar',
}
},
{
'slug': 'other',
'title': 'Other',
'secret_key': 'abcde',
'service-id': 'wcs',
'base_url': 'http://wcs.example.net'
},
]
}
old_stdin = sys.stdin
sys.stdin = StringIO.StringIO(json.dumps(hobo_json))
try:
call_command('hobo_deploy', 'http://passerelle.example.net', '-')
finally:
sys.stdin = old_stdin
assert len(list(TenantMiddleware.get_tenants())) == 1