# Copyright (c) 2021, Jingrow and Contributors
# See license.txt

import jingrow
from jingrow.tests.utils import JingrowTestCase

from jcloude.jcloude.pagetype.app.test_app import create_test_app
from jcloude.jcloude.pagetype.marketplace_app.test_marketplace_app import (
	create_test_marketplace_app,
)


def create_test_marketplace_app_plan(app: str = "jingrow"):
	"""Create a test marketplace_app_plan"""
	if not jingrow.db.exists("Marketplace App", app):
		create_test_app(name=app)
		create_test_marketplace_app(app)

	return jingrow.get_pg(
		{
			"pagetype": "Marketplace App Plan",
			"title": "Test Plan",
			"price_inr": 1000,
			"price_usd": 12,
			"app": app,
			"versions": [{"version": "Version 14"}],
			"features": [{"description": "Feature 1"}],
			"enabled": 1,
		}
	).insert(ignore_permissions=True)


class TestMarketplaceAppPlan(JingrowTestCase):
	pass
