-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
argocd_sale: Add tests
- Loading branch information
Showing
8 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ It uses a git generator (directory) to spawn e.g. Curq instances. | |
By simply adding a file in like this ``instances/**/config.yaml`` the application set generates a new application. | ||
This is how the repo should look like: `Example application set <[email protected]:onesteinbv/odoo-generator-k8s.git>`_ | ||
|
||
|
||
Configuration | ||
############# | ||
|
||
|
@@ -17,6 +18,8 @@ Configuration | |
#. Change system parameter ``application_set_directory`` to the directory where the instance configuration files are put `(default = instances)` | ||
#. Change system parameter ``application_domain_format`` used in creating domain names for applications if there's none specified | ||
|
||
**Assumes https is enabled for all exposed services.** | ||
|
||
Installation | ||
############ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import test_application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from odoo import Command | ||
from odoo.tests.common import TransactionCase | ||
|
||
|
||
class TestApplication(TransactionCase): | ||
def test_get_urls(self): | ||
app = self.env["argocd.application"].create( | ||
{ | ||
"name": "myapp", | ||
"template_id": self.ref( | ||
"argocd_deployer.demo_curq_basis_application_template" | ||
), | ||
"tag_ids": [ | ||
self.ref("argocd_deployer.demo_matomo_server_application_tag") | ||
], | ||
} | ||
) | ||
app.render_config() | ||
urls = app.get_urls() | ||
expected_urls = [ | ||
("https://myapp.curq.k8s.onestein.eu", "Odoo"), | ||
("https://matomo.myapp.curq.k8s.onestein.eu", "Matomo Server"), | ||
] | ||
self.assertEqual(urls, expected_urls) | ||
|
||
app.tag_ids = [Command.clear()] | ||
app.render_config() | ||
urls = app.get_urls() | ||
expected_urls = [("https://myapp.curq.k8s.onestein.eu", "Odoo")] | ||
self.assertEqual(urls, expected_urls) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import test_reseller | ||
from . import test_invoice_to_application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from odoo import Command | ||
from odoo.tests import common | ||
|
||
|
||
class TestInvoiceToApplication(common.TransactionCase): | ||
def test_name_should_never_conflict(self): | ||
"""Test if a customer can create multiple applications for themselves.""" | ||
partner = self.env["res.partner"].create({"name": "Onestein B.V. (some here)"}) | ||
product = self.env.ref( | ||
"argocd_sale.demo_curq_basis_product_template" | ||
).product_variant_ids | ||
orders = self.env["sale.order"].create( | ||
{ | ||
"partner_id": partner.id, | ||
"order_line": [ | ||
Command.create( | ||
{"name": "Product", "product_id": product.id, "price_unit": 0} | ||
) | ||
], | ||
} | ||
) | ||
orders += orders.copy() | ||
orders.action_confirm() | ||
invoices = orders._create_invoices(grouped=True) | ||
invoices.action_post() | ||
created_applications = self.env["argocd.application"].search( | ||
[("invoice_id", "in", invoices.ids)] | ||
) | ||
application_names = created_applications.mapped("name") | ||
self.assertEqual(len(created_applications), 2) | ||
self.assertIn("onestein-bv-some-here", application_names) | ||
self.assertIn("onestein-bv-some-here0", application_names) | ||
|
||
def test_never_multiple_applications(self): | ||
pass # TODO | ||
|
||
def test_application_tags(self): | ||
pass # TODO |