Automatically associate new service with an org

This is the same thing we do in the admin app at the moment with YAML:
2f4e933b65/app/utils.py (L556-L562)
This commit is contained in:
Chris Hill-Scott
2019-02-19 12:02:18 +00:00
parent d7e03e00d3
commit c0fb9267bd
6 changed files with 131 additions and 6 deletions

View File

@@ -51,7 +51,8 @@ from app.models import (
Complaint,
InvitedUser,
TemplateFolder,
LetterBranding
LetterBranding,
Domain,
)
@@ -497,6 +498,16 @@ def create_annual_billing(
return annual_billing
def create_domain(domain, organisation_id):
domain = Domain(domain=domain, organisation_id=organisation_id)
db.session.add(domain)
db.session.commit()
return domain
def create_organisation(name='test_org_1', active=True):
data = {
'name': name,