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

import unittest

import jingrow

from jcloud.jcloud.pagetype.app.test_app import create_test_app
from jcloud.jcloud.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_cny": 1000,
			"price_usd": 12,
			"app": app,
			"versions": [{"version": "v0.4"}],
			"features": [{"description": "Feature 1"}],
			"enabled": 1,
		}
	).insert(ignore_permissions=True)


class TestMarketplaceAppPlan(unittest.TestCase):
	pass
