mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[MIG] delivery_partner_ups: migrate to Odoo 13.0
Added tests
This commit is contained in:
committed by
Jared Kipe
parent
5143bc8067
commit
5e0c85cbb9
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
'name': 'UPS Partner Shipping Accounts',
|
'name': 'UPS Partner Shipping Accounts',
|
||||||
'author': 'Hibou Corp. <hello@hibou.io>',
|
'author': 'Hibou Corp. <hello@hibou.io>',
|
||||||
'version': '12.0.1.0.0',
|
'version': '13.0.1.0.0',
|
||||||
'category': 'Stock',
|
'category': 'Stock',
|
||||||
'sequence': 95,
|
'sequence': 95,
|
||||||
'summary': 'UPS Partner Shipping Accounts',
|
'summary': 'UPS Partner Shipping Accounts',
|
||||||
|
|||||||
1
delivery_partner_ups/tests/__init__.py
Normal file
1
delivery_partner_ups/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import test_ups_account
|
||||||
61
delivery_partner_ups/tests/test_ups_account.py
Normal file
61
delivery_partner_ups/tests/test_ups_account.py
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
from odoo.tests.common import TransactionCase
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
|
class TestAccount(TransactionCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestAccount, self).setUp()
|
||||||
|
self.PartnerShippingAccount = self.env['partner.shipping.account']
|
||||||
|
self.partner = self.env.ref('base.res_partner_12')
|
||||||
|
|
||||||
|
def test_ups_account_information(self):
|
||||||
|
# Create object and confirm that validation error raises if ups account number is blank or not 8 digits
|
||||||
|
with self.assertRaises(ValidationError):
|
||||||
|
wrong_account_number = self.PartnerShippingAccount.create({
|
||||||
|
'name': '1234567',
|
||||||
|
'description': 'Error Account',
|
||||||
|
'partner_id': self.partner.id,
|
||||||
|
'delivery_type': 'ups',
|
||||||
|
'note': 'This is a note',
|
||||||
|
'ups_zip': '12345'
|
||||||
|
})
|
||||||
|
|
||||||
|
with self.assertRaises(ValidationError):
|
||||||
|
no_account_number = self.PartnerShippingAccount.create({
|
||||||
|
'name': '',
|
||||||
|
'description': 'Error Account',
|
||||||
|
'partner_id': self.partner.id,
|
||||||
|
'delivery_type': 'ups',
|
||||||
|
'note': 'This is a note',
|
||||||
|
'ups_zip': '12345'
|
||||||
|
})
|
||||||
|
# Create object and confirm that validation error raises if zipcode is blank or not 5 digits
|
||||||
|
with self.assertRaises(ValidationError):
|
||||||
|
wrong_zip_code = self.PartnerShippingAccount.create({
|
||||||
|
'name': '123456',
|
||||||
|
'description': 'Error Account',
|
||||||
|
'partner_id': self.partner.id,
|
||||||
|
'delivery_type': 'ups',
|
||||||
|
'note': 'This is a note',
|
||||||
|
'ups_zip': '1234'
|
||||||
|
})
|
||||||
|
|
||||||
|
with self.assertRaises(ValidationError):
|
||||||
|
no_zip_code = self.PartnerShippingAccount.create({
|
||||||
|
'name': '123456',
|
||||||
|
'description': 'Error Account',
|
||||||
|
'partner_id': self.partner.id,
|
||||||
|
'delivery_type': 'ups',
|
||||||
|
'note': 'This is a note',
|
||||||
|
'ups_zip': ''
|
||||||
|
})
|
||||||
|
|
||||||
|
_ = self.PartnerShippingAccount.create({
|
||||||
|
'name': '123456',
|
||||||
|
'description': 'Error Account',
|
||||||
|
'partner_id': self.partner.id,
|
||||||
|
'delivery_type': 'ups',
|
||||||
|
'note': 'This is a note',
|
||||||
|
'ups_zip': '12345'
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user