-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] database_cleanup: preserve spaces in quoted identifiers
- Loading branch information
1 parent
b28e4e7
commit ae0fc4f
Showing
3 changed files
with
20 additions
and
1 deletion.
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,18 @@ | ||
from odoo.tests import TransactionCase | ||
|
||
from odoo.addons.database_cleanup.identifier_adapter import IdentifierAdapter | ||
|
||
|
||
class TestIdentifierAdapter(TransactionCase): | ||
def test_column_name_with_spaces(self): | ||
"""Spaces in column names are preserved except in unquoted identifiers.""" | ||
self.assertEqual( | ||
self.env.cr.mogrify("%s", (IdentifierAdapter("snailmail_cover "),)), | ||
b'"snailmail_cover "', | ||
) | ||
self.assertEqual( | ||
self.env.cr.mogrify( | ||
"%s", (IdentifierAdapter("snailmail_cover ", quote=False),) | ||
), | ||
b"snailmail_cover", | ||
) |