-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1553 from VoicuStefan2001/16.0-upd-deltatech_down…
…load [16.0][UPD] deltatech_download tests
- Loading branch information
Showing
6 changed files
with
32 additions
and
4 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
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,3 +1,4 @@ | ||
# © 2008-2021 Deltatech | ||
# Dorin Hongu <dhongu(@)gmail(.)com | ||
# See README.rst file on addons root folder for license details | ||
from . import test_download |
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,27 @@ | ||
import base64 | ||
|
||
from odoo.tests.common import TransactionCase | ||
|
||
|
||
class TestWizardDownloadFile(TransactionCase): | ||
|
||
def setUp(self): | ||
super().setUp() | ||
self.wizard = self.env["wizard.download.file"].create( | ||
{ | ||
"file_name": "test_file.txt", | ||
"data_file": base64.b64encode(b"Test file content"), | ||
} | ||
) | ||
|
||
def test_do_download_file(self): | ||
action = self.wizard.do_download_file() | ||
|
||
expected_url = ( | ||
"/web/content?model=wizard.download.file&download=True&field=data_file&id=%s&filename=test_file.txt" | ||
% self.wizard.id | ||
) | ||
|
||
self.assertEqual(action["type"], "ir.actions.act_url") | ||
self.assertEqual(action["url"], expected_url) | ||
self.assertEqual(action["target"], "new") |