forked from OCA/project
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UPD] project_forecast_line_deadlin: unit tests
- Loading branch information
1 parent
dbf7074
commit 3bce03a
Showing
4 changed files
with
41 additions
and
2 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
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_forecast_line_deadline |
28 changes: 28 additions & 0 deletions
28
project_forecast_line_deadline/tests/test_forecast_line_deadline.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,28 @@ | ||
# Copyright 2024 Therp BV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
import odoo.tests.common as common | ||
|
||
|
||
class TestForecastLineDeadline(common.TransactionCase): | ||
def setUp(self): | ||
super().setUp() | ||
self.project_task = self.env.ref("project.project_task_1") | ||
|
||
def test_forecast_end_deadline(self): | ||
"""Test forecast_date_planned_end vs date_deadline""" | ||
task = self.project_task | ||
# See that relevant date fields are falsy | ||
self.assertFalse(task.forecast_date_planned_end) | ||
self.assertFalse(task.date_deadline) | ||
# Set deadline for task | ||
task.date_deadline = "2022-01-01" | ||
# Date fields are equal | ||
self.assertEqual(task.forecast_date_planned_end, task.date_deadline) | ||
# Set forecast_date_deadline manually | ||
task.forecast_date_planned_end = "2022-02-01" | ||
# Dates are not the same anymore | ||
self.assertNotEqual(task.forecast_date_planned_end, task.date_deadline) | ||
# Reset both date fields to False | ||
task.date_deadline = False | ||
self.assertFalse(task.forecast_date_planned_end) |