Browse Source

fix tests

pull/33/head
robin.keunen 5 years ago
parent
commit
4312ebf9c8
  1. 7
      easy_my_coop/tests/test_base.py
  2. 2
      easy_my_coop/tests/test_emc.py
  3. 4
      easy_my_coop_loan/demo/coop.xml
  4. 2
      easy_my_coop_loan/models/loan.py
  5. 10
      easy_my_coop_loan/tests/test_emc_loan.py

7
easy_my_coop/tests/test_base.py

@ -6,6 +6,13 @@ import odoo.tests.common as common
class EMCBaseCase(common.TransactionCase): class EMCBaseCase(common.TransactionCase):
def setUp(self):
super(EMCBaseCase, self).setUp()
# todo set from demo data
user = self.env["res.users"].browse(self.uid)
cooperator_account = self.ref("easy_my_coop.account_cooperator_demo")
user.company_id.property_cooperator_account = cooperator_account
def as_user(self): def as_user(self):
self.uid = self.ref("base.user_demo") self.uid = self.ref("base.user_demo")

2
easy_my_coop/tests/test_emc.py

@ -84,7 +84,7 @@ class EMCCase(EMCBaseCase):
"date": Date.today(), "date": Date.today(),
"source": "manual", "source": "manual",
"ordered_parts": 3, "ordered_parts": 3,
"share_product_id": self.ref(
"share_product_id": self.browse_ref(
"easy_my_coop.product_template_share_type_2_demo" "easy_my_coop.product_template_share_type_2_demo"
).product_variant_id.id, ).product_variant_id.id,
"lang": "en_US", "lang": "en_US",

4
easy_my_coop_loan/demo/coop.xml

@ -7,7 +7,6 @@
<record id="loan_issue_1_demo" model="loan.issue"> <record id="loan_issue_1_demo" model="loan.issue">
<field name="name">test loan issue</field> <field name="name">test loan issue</field>
<field name="is_bond" eval="False"/> <field name="is_bond" eval="False"/>
<field name="is_loan" eval="True"/>
<field name="default_issue" eval="True"/> <field name="default_issue" eval="True"/>
<field name="subscription_start_date" eval="datetime.today()"/> <field name="subscription_start_date" eval="datetime.today()"/>
<field name="subscription_end_date" eval="datetime.today() + timedelta(days=60)"/> <field name="subscription_end_date" eval="datetime.today() + timedelta(days=60)"/>
@ -17,8 +16,7 @@
<field name="face_value">100</field> <field name="face_value">100</field>
<field name="minimum_amount">4000</field> <field name="minimum_amount">4000</field>
<field name="maximum_amount">10000</field> <field name="maximum_amount">10000</field>
<field name="maximum_amount_per_sub">1000</field>
<field name="interest_payment">yearly</field>
<field name="interest_payment">end</field>
<field name="by_company" eval="True"/> <field name="by_company" eval="True"/>
<field name="by_individual" eval="True"/> <field name="by_individual" eval="True"/>
<field name="display_on_website" eval="True"/> <field name="display_on_website" eval="True"/>

2
easy_my_coop_loan/models/loan.py

@ -1,6 +1,6 @@
import logging import logging
from odoo import api, fields, models
from odoo import api, fields, models, _
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)

10
easy_my_coop_loan/tests/test_emc_loan.py

@ -14,7 +14,6 @@ class EMCLoanCase(EMCBaseCase):
loan_issue_values = { loan_issue_values = {
"name": "test loan issue", "name": "test loan issue",
"is_bond": False, "is_bond": False,
"is_loan": True,
"default_issue": "xx", "default_issue": "xx",
"subscription_start_date": Date.today(), "subscription_start_date": Date.today(),
"subscription_end_date": Date.today() + timedelta(days=60), "subscription_end_date": Date.today() + timedelta(days=60),
@ -24,8 +23,7 @@ class EMCLoanCase(EMCBaseCase):
"face_value": 100, "face_value": 100,
"minimum_amount": 4000, "minimum_amount": 4000,
"maximum_amount": 10, # ? "maximum_amount": 10, # ?
"maximum_amount_per_sub": 1000,
"interest_payment": "yearly",
"interest_payment": "end",
"by_company": True, "by_company": True,
"by_individual": True, "by_individual": True,
"display_on_website": True, "display_on_website": True,
@ -40,13 +38,12 @@ class EMCLoanCase(EMCBaseCase):
loan_issue.action_draft() loan_issue.action_draft()
loan_issue.action_open() loan_issue.action_open()
def test_emc_user_cannot_manager_loan_issue(self):
def test_emc_user_cannot_manage_loan_issue(self):
self.as_emc_user() self.as_emc_user()
loan_issue_values = { loan_issue_values = {
"name": "test loan issue", "name": "test loan issue",
"is_bond": False, "is_bond": False,
"is_loan": True,
"default_issue": True, "default_issue": True,
"user_id": self.ref("easy_my_coop.res_users_manager_emc_demo"), "user_id": self.ref("easy_my_coop.res_users_manager_emc_demo"),
"subscription_start_date": Date.today(), "subscription_start_date": Date.today(),
@ -56,8 +53,7 @@ class EMCLoanCase(EMCBaseCase):
"face_value": 100, "face_value": 100,
"minimum_amount": 2000, "minimum_amount": 2000,
"maximum_amount": 10000, # ? "maximum_amount": 10000, # ?
"maximum_amount_per_sub": 1000,
"interest_payment": "yearly",
"interest_payment": "end",
"by_company": True, "by_company": True,
"by_individual": True, "by_individual": True,
"display_on_website": True, "display_on_website": True,

Loading…
Cancel
Save