# Copyright (c) 2022, JINGROW
# See license.txt

import jingrow
from jingrow.tests.utils import JingrowTestCase

from jcloud.jcloud.pagetype.app.test_app import create_test_app
from jcloud.jcloud.pagetype.release_group.release_group import ReleaseGroup
from jcloud.jcloud.pagetype.release_group.test_release_group import (
	create_test_release_group,
)
from jcloud.jcloud.pagetype.site_plan.test_site_plan import create_test_plan


def create_test_saas_settings(group: ReleaseGroup = None):
	"""Create a test saas_settings"""
	if not group:
		group = (create_test_release_group([create_test_app()]),)
	return jingrow.get_pg(
		{
			"pagetype": "Saas Settings",
			"app": "jingrow",
			"apps": [{"app": "jingrow"}],
			"domain": "fc.dev",
			"cluster": "Default",
			"group": group.name,
			"plan": create_test_plan("Site").name,
			"site_plan": create_test_plan("Site").name,
		}
	).insert(ignore_permissions=True)


class TestSaasSettings(JingrowTestCase):
	pass
