-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] fleet_vehicle_capacity: add tests
- Loading branch information
1 parent
069f332
commit eff28e2
Showing
2 changed files
with
71 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import test_fleet_vehicle_capacity |
70 changes: 70 additions & 0 deletions
70
fleet_vehicle_capacity/tests/test_fleet_vehicle_capacity.py
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,70 @@ | ||
# Copyright 2024 - TODAY, Marcel Savegnago <marcel.savegnago@escodoo.com.br> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo.tests import common | ||
|
||
|
||
class TestFleetVehicleCapacity(common.TransactionCase): | ||
def setUp(self): | ||
super(TestFleetVehicleCapacity, self).setUp() | ||
|
||
self.uom_ton = self.env.ref("uom.product_uom_ton") | ||
self.uom_m3 = self.env.ref("uom.product_uom_cubic_meter") | ||
self.uom_unit = self.env.ref("uom.product_uom_unit") | ||
|
||
self.res_config_settings = self.env["res.config.settings"].create( | ||
{ | ||
"vehicle_weight_uom_id": self.uom_ton.id, | ||
"vehicle_volume_uom_id": self.uom_m3.id, | ||
"vehicle_passenger_uom_id": self.uom_unit.id, | ||
} | ||
) | ||
|
||
self.res_config_settings.execute() | ||
|
||
self.vehicle_model = self.env["fleet.vehicle.model"].create( | ||
{ | ||
"name": "Test Model", | ||
"vehicle_weight": 5.0, | ||
"weight_capacity": 2.0, | ||
"volume_capacity": 10.0, | ||
"passenger_capacity": 4.0, | ||
} | ||
) | ||
|
||
def test_default_vehicle_weight_uom(self): | ||
self.assertEqual( | ||
self.vehicle_model.weight_uom_id, | ||
self.uom_ton, | ||
"Default Vehicle Weight UOM is incorrect", | ||
) | ||
|
||
def test_default_vehicle_volume_uom(self): | ||
self.assertEqual( | ||
self.vehicle_model.volume_uom_id, | ||
self.uom_m3, | ||
"Default Vehicle Volume UOM is incorrect", | ||
) | ||
|
||
def test_default_vehicle_passenger_uom(self): | ||
self.assertEqual( | ||
self.vehicle_model.passenger_uom_id, | ||
self.uom_unit, | ||
"Default Vehicle Passenger UOM is incorrect", | ||
) | ||
|
||
def test_vehicle_model_fields(self): | ||
self.assertEqual( | ||
self.vehicle_model.vehicle_weight, 5.0, "Vehicle weight is incorrect" | ||
) | ||
self.assertEqual( | ||
self.vehicle_model.weight_capacity, 2.0, "Weight capacity is incorrect" | ||
) | ||
self.assertEqual( | ||
self.vehicle_model.volume_capacity, 10.0, "Volume capacity is incorrect" | ||
) | ||
self.assertEqual( | ||
self.vehicle_model.passenger_capacity, | ||
4.0, | ||
"Passenger capacity is incorrect", | ||
) |