robotframework-odoofx 0.2.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. robotframework_odoofx-0.3.0/NOTICE +88 -0
  2. {robotframework_odoofx-0.2.0/src/robotframework_odoofx.egg-info → robotframework_odoofx-0.3.0}/PKG-INFO +51 -9
  3. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/README.md +45 -8
  4. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/pyproject.toml +4 -1
  5. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/src/OdooFxLibrary/__init__.py +1 -1
  6. robotframework_odoofx-0.3.0/src/OdooFxLibrary/http_authenticated_sessions.py +160 -0
  7. robotframework_odoofx-0.3.0/src/OdooFxLibrary/http_keywords.py +15 -0
  8. robotframework_odoofx-0.3.0/src/OdooFxLibrary/http_log.py +163 -0
  9. robotframework_odoofx-0.3.0/src/OdooFxLibrary/http_odoo_session.py +99 -0
  10. robotframework_odoofx-0.3.0/src/OdooFxLibrary/http_odoo_write_guard.py +247 -0
  11. robotframework_odoofx-0.3.0/src/OdooFxLibrary/http_requests.py +389 -0
  12. robotframework_odoofx-0.3.0/src/OdooFxLibrary/http_requests_without_session.py +121 -0
  13. robotframework_odoofx-0.3.0/src/OdooFxLibrary/http_sessions.py +243 -0
  14. robotframework_odoofx-0.3.0/src/OdooFxLibrary/http_status_assertions.py +69 -0
  15. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/src/OdooFxLibrary/odoo_library.py +30 -196
  16. robotframework_odoofx-0.3.0/src/OdooFxLibrary/pdf_text.py +119 -0
  17. robotframework_odoofx-0.3.0/src/OdooFxLibrary/record_writes.py +206 -0
  18. robotframework_odoofx-0.3.0/src/OdooFxLibrary/report_pdf.py +209 -0
  19. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/src/OdooFxLibrary/rpc.py +41 -28
  20. robotframework_odoofx-0.3.0/src/OdooFxLibrary/session_context.py +169 -0
  21. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/src/OdooFxLibrary/web.py +18 -9
  22. robotframework_odoofx-0.3.0/src/OdooFxLibrary/web_buttons.py +212 -0
  23. robotframework_odoofx-0.3.0/src/OdooFxLibrary/web_channel.py +22 -0
  24. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/src/OdooFxLibrary/web_client.py +110 -4
  25. robotframework_odoofx-0.3.0/src/OdooFxLibrary/web_dialog.py +208 -0
  26. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/src/OdooFxLibrary/web_form.py +145 -50
  27. robotframework_odoofx-0.3.0/src/OdooFxLibrary/web_lines.py +280 -0
  28. robotframework_odoofx-0.3.0/src/OdooFxLibrary/web_numbers.py +70 -0
  29. robotframework_odoofx-0.3.0/src/OdooFxLibrary/web_record_actions.py +347 -0
  30. robotframework_odoofx-0.3.0/src/OdooFxLibrary/web_records.py +80 -0
  31. robotframework_odoofx-0.3.0/src/OdooFxLibrary/web_search.py +433 -0
  32. robotframework_odoofx-0.3.0/src/OdooFxLibrary/web_sections.py +136 -0
  33. robotframework_odoofx-0.3.0/src/OdooFxLibrary/web_views.py +57 -0
  34. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0/src/robotframework_odoofx.egg-info}/PKG-INFO +51 -9
  35. robotframework_odoofx-0.3.0/src/robotframework_odoofx.egg-info/SOURCES.txt +40 -0
  36. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/src/robotframework_odoofx.egg-info/requires.txt +7 -0
  37. robotframework_odoofx-0.2.0/NOTICE +0 -43
  38. robotframework_odoofx-0.2.0/src/OdooFxLibrary/web_buttons.py +0 -90
  39. robotframework_odoofx-0.2.0/src/OdooFxLibrary/web_lines.py +0 -115
  40. robotframework_odoofx-0.2.0/src/robotframework_odoofx.egg-info/SOURCES.txt +0 -19
  41. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/LICENSE +0 -0
  42. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/setup.cfg +0 -0
  43. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/src/OdooFxLibrary/orm.py +0 -0
  44. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/src/OdooFxLibrary/web_choices.py +0 -0
  45. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/src/robotframework_odoofx.egg-info/dependency_links.txt +0 -0
  46. {robotframework_odoofx-0.2.0 → robotframework_odoofx-0.3.0}/src/robotframework_odoofx.egg-info/top_level.txt +0 -0
@@ -0,0 +1,88 @@
1
+ ODOOFX
2
+ Copyright 2026 Cyril Montiel
3
+
4
+ Licensed under the Apache License, Version 2.0 (see LICENSE file).
5
+
6
+ ================================================================================
7
+ THIRD-PARTY COMPONENTS
8
+ ================================================================================
9
+
10
+ The robotframework-odoofx package contains code derived from one third-party
11
+ project, listed under ABSORBED CODE below. It depends on the following
12
+ projects, installed from PyPI under their own licenses:
13
+
14
+ 1. Robot Framework
15
+ - Project: https://robotframework.org/
16
+ - License: Apache License 2.0
17
+ - Used for: keyword library API, typed secrets, test execution
18
+
19
+ 2. Requests
20
+ - Project: https://requests.readthedocs.io/
21
+ - License: Apache License 2.0
22
+ - Used for: the JSON-2 channel (Odoo 19 and later) and the HTTP keywords
23
+
24
+ 3. Robot Framework Browser library (optional, `web` extra)
25
+ - Project: https://github.com/MarketSquare/robotframework-browser
26
+ - License: Apache License 2.0
27
+ - Used for: the web channel, through Playwright
28
+ (https://playwright.dev/, Apache License 2.0)
29
+
30
+ 4. pypdf (optional, `pdf` extra)
31
+ - Project: https://github.com/py-pdf/pypdf
32
+ - License: BSD 3-Clause License
33
+ - Used for: reading the text of a report PDF
34
+
35
+ 5. requests_ntlm (optional, `ntlm` extra)
36
+ - Project: https://github.com/requests/requests-ntlm
37
+ - License: ISC License
38
+ - Used for: the NTLM authenticated HTTP sessions
39
+
40
+ ================================================================================
41
+ ABSORBED CODE
42
+ ================================================================================
43
+
44
+ robotframework-requests (RequestsLibrary) 0.9.7
45
+ - Project: https://github.com/MarketSquare/robotframework-requests
46
+ - License: MIT License
47
+ - Absorbed: its session, request and log code is rewritten in
48
+ src/OdooFxLibrary/http_sessions.py, http_authenticated_sessions.py,
49
+ http_requests.py, http_requests_without_session.py,
50
+ http_status_assertions.py and http_log.py (each module names its
51
+ origin); the keyword names and their parameters
52
+ are kept, so that a suite written for RequestsLibrary keeps working.
53
+
54
+ Copyright (c) 2016 Bulkan Evcimen
55
+
56
+ Permission is hereby granted, free of charge, to any person obtaining a copy
57
+ of this software and associated documentation files (the "Software"), to deal
58
+ in the Software without restriction, including without limitation the rights
59
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
60
+ copies of the Software, and to permit persons to whom the Software is
61
+ furnished to do so, subject to the following conditions:
62
+
63
+ The above copyright notice and this permission notice shall be included in
64
+ all copies or substantial portions of the Software.
65
+
66
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
67
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
68
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
69
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
70
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
71
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
72
+ THE SOFTWARE.
73
+
74
+ ================================================================================
75
+ DESIGN LINEAGE
76
+ ================================================================================
77
+
78
+ The method around the library (spec-driven test agents, guards) follows
79
+ rf-test-agents (https://github.com/CyrilM29/rf-test-agents, Apache License
80
+ 2.0, same author). No code of it is part of this package.
81
+
82
+ ================================================================================
83
+ TRADEMARKS
84
+ ================================================================================
85
+
86
+ Odoo is a trademark of Odoo S.A. Robot Framework is a trademark of the Robot
87
+ Framework Foundation. ODOOFX is an independent project, not affiliated with,
88
+ sponsored or endorsed by Odoo S.A. or the Robot Framework Foundation.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: robotframework-odoofx
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: ODOOFX: Robot Framework library for testing Odoo through its web client (Browser library) and its external API (XML-RPC up to Odoo 18, JSON-2 from Odoo 19), with opt-in journaled writes.
5
5
  Author-email: Cyril Montiel <cyril@montiel.me>
6
6
  License-Expression: Apache-2.0
@@ -32,8 +32,13 @@ Requires-Dist: robotframework>=7.4
32
32
  Requires-Dist: requests>=2.28.0
33
33
  Provides-Extra: web
34
34
  Requires-Dist: robotframework-browser<21,>=20.0; extra == "web"
35
+ Provides-Extra: ntlm
36
+ Requires-Dist: requests_ntlm>=1.1; extra == "ntlm"
37
+ Provides-Extra: pdf
38
+ Requires-Dist: pypdf>=4.0; extra == "pdf"
35
39
  Provides-Extra: all
36
40
  Requires-Dist: robotframework-odoofx[web]; extra == "all"
41
+ Requires-Dist: robotframework-odoofx[pdf]; extra == "all"
37
42
  Dynamic: license-file
38
43
 
39
44
  # ODOOFX: Odoo library for Robot Framework
@@ -55,9 +60,11 @@ actually test. It targets Odoo Community and Enterprise, and is **proven live
55
60
  on Odoo 16 and Odoo 19 Community** (it is designed for Odoo 14 and later; 14,
56
61
  15, 17 and 18 are not measured yet).
57
62
 
58
- > **Status: alpha.** Both channels work and are proven live on Odoo 16 and 19.
59
- > Not covered yet: buttons that open a wizard, section and note lines, line
60
- > deletion. Signatures may still change before 1.0.
63
+ > **Status: alpha.** Both channels work and are proven live on Odoo 16 and 19,
64
+ > with an HTTP channel (the keywords of RequestsLibrary, absorbed) and the report
65
+ > PDFs Odoo prints. Not covered yet: the kanban, calendar, pivot and graph views,
66
+ > the chatter, the mass actions of a list, Odoo's legacy `/jsonrpc` route.
67
+ > Signatures may still change before 1.0.
61
68
 
62
69
  ## Install
63
70
 
@@ -65,7 +72,7 @@ Requirements: Python 3.10 or later, Robot Framework 7.4 or later, and an Odoo
65
72
  instance reachable over HTTP. The RPC channel needs nothing more. The `web`
66
73
  extra (`pip install "robotframework-odoofx[web]"`, then `rfbrowser init` once
67
74
  for the Playwright browsers) brings the Browser library the web channel is
68
- built on; `all` installs every extra.
75
+ built on; the `pdf` extra (`pypdf`) reads the text of a report; `all` installs every extra.
69
76
 
70
77
  Keyword documentation:
71
78
  [cyrilm29.github.io/robotframework-odoofx](https://cyrilm29.github.io/robotframework-odoofx/).
@@ -185,6 +192,37 @@ variable keeps them out of the logs) or through the environment.
185
192
  | `Get Odoo Module State`, `Odoo Module Should Be Installed` | The state code of a module; fail unless installed |
186
193
  | `Call Odoo Model Method` | Call a method that needs no record (`name_search`, `search_count`...); a method that may write needs `allow_write` and is journaled |
187
194
 
195
+ **Session context** (RPC channel: Odoo applies no preference of the user to an RPC call):
196
+
197
+ | Keyword | Purpose |
198
+ | --- | --- |
199
+ | `Set Odoo Session Context` | A language, time zone or companies sent with every RPC call of the connection, under the context a keyword passes; an inactive language, an unknown time zone or a company the user does not have is refused at once |
200
+ | `Get Odoo Session Context`, `Clear Odoo Session Context` | Read or empty the session context (a new connection starts empty) |
201
+ | `Get Odoo User Context` | The preferences of the connected user as Odoo gives them (`lang`, `tz`) |
202
+
203
+ **HTTP** (the session and request keywords of RequestsLibrary, absorbed under their names and arguments, the secrets they recognize masked in the log):
204
+
205
+ | Keyword | Purpose |
206
+ | --- | --- |
207
+ | `Create Session`, `Update Session`, `Session Exists`, `Delete All Sessions` | Open an HTTP session towards a server under an alias, merge headers or cookies into it, find it, close them all |
208
+ | `Create Custom Session`, `Create Digest Session`, `Create Client Cert Session`, `Create Ntlm Session` | Open a session authenticated by any requests authentication, HTTP Digest, a client certificate, or NTLM (optional extra `ntlm`) |
209
+ | `GET On Session`, `POST On Session`, `PUT On Session`, `PATCH On Session`, `DELETE On Session`, `HEAD On Session`, `OPTIONS On Session` | Send a request on a session; without `expected_status` a 4xx or 5xx fails, as in RequestsLibrary; HEAD does not follow a redirect, the other verbs do |
210
+ | `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `HEAD`, `OPTIONS` | Send a request to a full URL without a session; unlike RequestsLibrary, no cookie nor timeout of another session goes with it |
211
+ | `Status Should Be`, `Request Should Be Successful`, `Get File For Streaming Upload` | Assert the status of the response given, or of the last one (a failed response given is judged, unlike RequestsLibrary); open a file to stream as a request body |
212
+ | `Create Odoo Http Session` | An authenticated Odoo web session on the proven target, proven by its database, series and user, for the routes a logged user reaches (a report PDF) |
213
+
214
+ A write on Odoo through these keywords (a call of its RPC routes or a website form whose method is not a read) is refused before it is sent unless `Connect To Odoo` proved that target and opened it with `allow_write=${TRUE}`; it then enters the write journal and is sent once.
215
+
216
+ Coming from RequestsLibrary? The [migration guide](https://github.com/CyrilM29/robotframework-odoofx/blob/main/docs/migrating-from-requestslibrary.md) gives each deliberate change, its effect on a suite and its remedy.
217
+
218
+ **Reports** (the PDF Odoo prints, through a web session of `Create Odoo Http Session`; its text needs the `pdf` extra):
219
+
220
+ | Keyword | Purpose |
221
+ | --- | --- |
222
+ | `Get Odoo Report Pdf` | The PDF of a report action on records, by Odoo's report route without following a redirect, a redirect, another status or another type named; refused before any request when the action would save the PDF as an attachment, unless accepted on a writing connection |
223
+ | `Get Pdf Text`, `Pdf Should Contain`, `Pdf Should Not Contain` | The text of the PDF, normalized on both sides (Unicode spaces, line breaks, a reference the template wrapped at its hyphen), and a value asserted in it or absent from it; a PDF without a text layer fails saying so |
224
+ | `Get Odoo Formatted Amount` | An amount as Odoo writes it in a document of a language and a currency, read from `res.lang` and `res.currency` |
225
+
188
226
  **Web client: session, navigation and reads** (built on the Browser library,
189
227
  which opens the browser, the context and the page):
190
228
 
@@ -196,7 +234,8 @@ which opens the browser, the context and the page):
196
234
  | `Navigate To Menu` | Open an application, then its menus, by external ids (`sale.sale_menu_root`), never by label; waits for the view that replaces the one shown |
197
235
  | `Get Odoo Web View`, `Get Odoo Web Current App` | The view shown (model, view type, action, record id) and the application of the menu bar |
198
236
  | `Count Odoo Web View Records`, `Get Odoo Web Pager Total`, `Count Odoo Web Search Facets` | What the list or kanban shows: records (ghost cards excluded), the pager's total, the search facets |
199
- | `Open Odoo Web Record`, `Get Odoo Web List Cell Text`, `Get Odoo Web Breadcrumb Depth`, `Go Back Through Odoo Web Breadcrumb` | Open a shown record in its form (by the cell of a named field), read a list cell, read and walk back the breadcrumb |
237
+ | `Search Odoo Web View`, `Select Odoo Web Search Filter`, `Remove Odoo Web Search Facet`, `Switch Odoo Web View` | Search a list through its search bar: a text on a field, or a filter, of the search view, named by its technical name (found at its place in the view's arch, the domain the client sends checked against the arch); remove a facet; switch the action's view (list, kanban). Each waits for the list Odoo shows, returns the count it answered, and writes nothing |
238
+ | `Open Odoo Web Record`, `Open Odoo Web Record By Id`, `Get Odoo Web List Cell Text`, `Get Odoo Web Breadcrumb Depth`, `Go Back Through Odoo Web Breadcrumb` | Open a shown record in its form (by the cell of a named field), or any record by its model and id (one a suite created over RPC), read a list cell, read and walk back the breadcrumb |
200
239
  | `Get Odoo Web Statusbar Value`, `Odoo Web Form Should Be Saved` | The technical code of the form's current step; no pending change |
201
240
  | `Count Odoo Records Through Web Session`, `Search Read Odoo Records Through Web Session` | Reads with the page's session cookie, on the same route from Odoo 16 to 19 |
202
241
  | `Log Out Of Odoo Web Client` | Log out through the user menu |
@@ -207,10 +246,13 @@ are journaled):
207
246
  | Keyword | Purpose |
208
247
  | --- | --- |
209
248
  | `Open New Odoo Web Form`, `Select Odoo Web Form Tab` | Open the form of a new record from a list or kanban; show a notebook page by its name |
210
- | `Fill Odoo Web Field`, `Get Odoo Web Field Value` | Enter a value and read it back on the screen at once: text, dates (given as ISO, typed in the user's format), radio option and selection by code, checkbox, many2one and tags by exact name or by id; read what the form shows |
249
+ | `Fill Odoo Web Field`, `Get Odoo Web Field Value` | Enter a value and read it back on the screen at once: text, numbers and dates (given as `2.5` and ISO, typed in the user's format), radio option and selection by code, checkbox, many2one and tags by exact name or by id; read what the form shows, a number field as a number |
211
250
  | `Save Odoo Web Record`, `Discard Odoo Web Changes`, `Get Odoo Web Invalid Fields`, `Odoo Web Form Is Unsaved` | Save and get the record id, or a refusal naming its cause; drop pending changes; the fields marked invalid; whether the form holds unsaved changes |
212
- | `Add Odoo Web Line`, `Fill Odoo Web Line Field`, `Get Odoo Web Lines` | Add a line to a one2many field (the lines of a sales order), fill a field of the line in edition, read the lines once shown as stored |
213
- | `Click Odoo Web Form Button` | Press a button that calls a method of the record (`action_confirm`), by its technical name; waits until Odoo answered and reloaded the record; needs `allow_write`, journaled |
251
+ | `Add Odoo Web Line`, `Fill Odoo Web Line Field`, `Get Odoo Web Lines`, `Get Odoo Web Line Field Value`, `Delete Odoo Web Line` | Add a line to a one2many field (the lines of a sales order), a section or a note by its `display_type`; fill a field of the line in edition (the text of a section or a note on Odoo 16 and 19 alike); read the lines once shown as stored, with their type; read one field of a line, a number as a number in the user's format; delete a line by its position |
252
+ | `Delete Odoo Web Section` | Delete a section of a list of lines with the lines Odoo attaches to it, by its menu as Odoo 19 does (a subsection up to the next section or subsection); refused before any click on Odoo 16, whose delete button of a section removes its row alone |
253
+ | `Click Odoo Web Form Button` | Press a button that calls a method of the record (`action_confirm`), by its technical name, waiting until Odoo answered and reloaded the record (needs `allow_write`, journaled); or a button that opens a window action, by the action's external id, without writing |
254
+ | `Archive Odoo Web Record`, `Unarchive Odoo Web Record`, `Delete Odoo Web Record`, `Odoo Web Confirmation Is Open` | Archive, unarchive or delete the record of the form through its Actions menu, the entry told by its icon (Odoo 19) or by the place the code of Odoo gives it (Odoo 16), never by its label; Odoo's question accepted, or refused with `confirm=${FALSE}`; journaled, Odoo's refusal reported with the class of its exception; whether a question of Odoo is open |
255
+ | `Odoo Web Dialog Is Open`, `Fill Odoo Web Dialog Field`, `Get Odoo Web Dialog Field Value`, `Click Odoo Web Dialog Button`, `Close Odoo Web Dialog` | Work in the dialog a button opened (a wizard): whether one is shown, enter and read its fields on the wizard's model, press a button of its footer by its technical name (and its id when several share it; needs `allow_write`, journaled) and get the view it opens, close it without writing |
214
256
 
215
257
  `Create New Quotation` is a skeleton that only warns: do not rely on it.
216
258
 
@@ -17,9 +17,11 @@ actually test. It targets Odoo Community and Enterprise, and is **proven live
17
17
  on Odoo 16 and Odoo 19 Community** (it is designed for Odoo 14 and later; 14,
18
18
  15, 17 and 18 are not measured yet).
19
19
 
20
- > **Status: alpha.** Both channels work and are proven live on Odoo 16 and 19.
21
- > Not covered yet: buttons that open a wizard, section and note lines, line
22
- > deletion. Signatures may still change before 1.0.
20
+ > **Status: alpha.** Both channels work and are proven live on Odoo 16 and 19,
21
+ > with an HTTP channel (the keywords of RequestsLibrary, absorbed) and the report
22
+ > PDFs Odoo prints. Not covered yet: the kanban, calendar, pivot and graph views,
23
+ > the chatter, the mass actions of a list, Odoo's legacy `/jsonrpc` route.
24
+ > Signatures may still change before 1.0.
23
25
 
24
26
  ## Install
25
27
 
@@ -27,7 +29,7 @@ Requirements: Python 3.10 or later, Robot Framework 7.4 or later, and an Odoo
27
29
  instance reachable over HTTP. The RPC channel needs nothing more. The `web`
28
30
  extra (`pip install "robotframework-odoofx[web]"`, then `rfbrowser init` once
29
31
  for the Playwright browsers) brings the Browser library the web channel is
30
- built on; `all` installs every extra.
32
+ built on; the `pdf` extra (`pypdf`) reads the text of a report; `all` installs every extra.
31
33
 
32
34
  Keyword documentation:
33
35
  [cyrilm29.github.io/robotframework-odoofx](https://cyrilm29.github.io/robotframework-odoofx/).
@@ -147,6 +149,37 @@ variable keeps them out of the logs) or through the environment.
147
149
  | `Get Odoo Module State`, `Odoo Module Should Be Installed` | The state code of a module; fail unless installed |
148
150
  | `Call Odoo Model Method` | Call a method that needs no record (`name_search`, `search_count`...); a method that may write needs `allow_write` and is journaled |
149
151
 
152
+ **Session context** (RPC channel: Odoo applies no preference of the user to an RPC call):
153
+
154
+ | Keyword | Purpose |
155
+ | --- | --- |
156
+ | `Set Odoo Session Context` | A language, time zone or companies sent with every RPC call of the connection, under the context a keyword passes; an inactive language, an unknown time zone or a company the user does not have is refused at once |
157
+ | `Get Odoo Session Context`, `Clear Odoo Session Context` | Read or empty the session context (a new connection starts empty) |
158
+ | `Get Odoo User Context` | The preferences of the connected user as Odoo gives them (`lang`, `tz`) |
159
+
160
+ **HTTP** (the session and request keywords of RequestsLibrary, absorbed under their names and arguments, the secrets they recognize masked in the log):
161
+
162
+ | Keyword | Purpose |
163
+ | --- | --- |
164
+ | `Create Session`, `Update Session`, `Session Exists`, `Delete All Sessions` | Open an HTTP session towards a server under an alias, merge headers or cookies into it, find it, close them all |
165
+ | `Create Custom Session`, `Create Digest Session`, `Create Client Cert Session`, `Create Ntlm Session` | Open a session authenticated by any requests authentication, HTTP Digest, a client certificate, or NTLM (optional extra `ntlm`) |
166
+ | `GET On Session`, `POST On Session`, `PUT On Session`, `PATCH On Session`, `DELETE On Session`, `HEAD On Session`, `OPTIONS On Session` | Send a request on a session; without `expected_status` a 4xx or 5xx fails, as in RequestsLibrary; HEAD does not follow a redirect, the other verbs do |
167
+ | `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `HEAD`, `OPTIONS` | Send a request to a full URL without a session; unlike RequestsLibrary, no cookie nor timeout of another session goes with it |
168
+ | `Status Should Be`, `Request Should Be Successful`, `Get File For Streaming Upload` | Assert the status of the response given, or of the last one (a failed response given is judged, unlike RequestsLibrary); open a file to stream as a request body |
169
+ | `Create Odoo Http Session` | An authenticated Odoo web session on the proven target, proven by its database, series and user, for the routes a logged user reaches (a report PDF) |
170
+
171
+ A write on Odoo through these keywords (a call of its RPC routes or a website form whose method is not a read) is refused before it is sent unless `Connect To Odoo` proved that target and opened it with `allow_write=${TRUE}`; it then enters the write journal and is sent once.
172
+
173
+ Coming from RequestsLibrary? The [migration guide](https://github.com/CyrilM29/robotframework-odoofx/blob/main/docs/migrating-from-requestslibrary.md) gives each deliberate change, its effect on a suite and its remedy.
174
+
175
+ **Reports** (the PDF Odoo prints, through a web session of `Create Odoo Http Session`; its text needs the `pdf` extra):
176
+
177
+ | Keyword | Purpose |
178
+ | --- | --- |
179
+ | `Get Odoo Report Pdf` | The PDF of a report action on records, by Odoo's report route without following a redirect, a redirect, another status or another type named; refused before any request when the action would save the PDF as an attachment, unless accepted on a writing connection |
180
+ | `Get Pdf Text`, `Pdf Should Contain`, `Pdf Should Not Contain` | The text of the PDF, normalized on both sides (Unicode spaces, line breaks, a reference the template wrapped at its hyphen), and a value asserted in it or absent from it; a PDF without a text layer fails saying so |
181
+ | `Get Odoo Formatted Amount` | An amount as Odoo writes it in a document of a language and a currency, read from `res.lang` and `res.currency` |
182
+
150
183
  **Web client: session, navigation and reads** (built on the Browser library,
151
184
  which opens the browser, the context and the page):
152
185
 
@@ -158,7 +191,8 @@ which opens the browser, the context and the page):
158
191
  | `Navigate To Menu` | Open an application, then its menus, by external ids (`sale.sale_menu_root`), never by label; waits for the view that replaces the one shown |
159
192
  | `Get Odoo Web View`, `Get Odoo Web Current App` | The view shown (model, view type, action, record id) and the application of the menu bar |
160
193
  | `Count Odoo Web View Records`, `Get Odoo Web Pager Total`, `Count Odoo Web Search Facets` | What the list or kanban shows: records (ghost cards excluded), the pager's total, the search facets |
161
- | `Open Odoo Web Record`, `Get Odoo Web List Cell Text`, `Get Odoo Web Breadcrumb Depth`, `Go Back Through Odoo Web Breadcrumb` | Open a shown record in its form (by the cell of a named field), read a list cell, read and walk back the breadcrumb |
194
+ | `Search Odoo Web View`, `Select Odoo Web Search Filter`, `Remove Odoo Web Search Facet`, `Switch Odoo Web View` | Search a list through its search bar: a text on a field, or a filter, of the search view, named by its technical name (found at its place in the view's arch, the domain the client sends checked against the arch); remove a facet; switch the action's view (list, kanban). Each waits for the list Odoo shows, returns the count it answered, and writes nothing |
195
+ | `Open Odoo Web Record`, `Open Odoo Web Record By Id`, `Get Odoo Web List Cell Text`, `Get Odoo Web Breadcrumb Depth`, `Go Back Through Odoo Web Breadcrumb` | Open a shown record in its form (by the cell of a named field), or any record by its model and id (one a suite created over RPC), read a list cell, read and walk back the breadcrumb |
162
196
  | `Get Odoo Web Statusbar Value`, `Odoo Web Form Should Be Saved` | The technical code of the form's current step; no pending change |
163
197
  | `Count Odoo Records Through Web Session`, `Search Read Odoo Records Through Web Session` | Reads with the page's session cookie, on the same route from Odoo 16 to 19 |
164
198
  | `Log Out Of Odoo Web Client` | Log out through the user menu |
@@ -169,10 +203,13 @@ are journaled):
169
203
  | Keyword | Purpose |
170
204
  | --- | --- |
171
205
  | `Open New Odoo Web Form`, `Select Odoo Web Form Tab` | Open the form of a new record from a list or kanban; show a notebook page by its name |
172
- | `Fill Odoo Web Field`, `Get Odoo Web Field Value` | Enter a value and read it back on the screen at once: text, dates (given as ISO, typed in the user's format), radio option and selection by code, checkbox, many2one and tags by exact name or by id; read what the form shows |
206
+ | `Fill Odoo Web Field`, `Get Odoo Web Field Value` | Enter a value and read it back on the screen at once: text, numbers and dates (given as `2.5` and ISO, typed in the user's format), radio option and selection by code, checkbox, many2one and tags by exact name or by id; read what the form shows, a number field as a number |
173
207
  | `Save Odoo Web Record`, `Discard Odoo Web Changes`, `Get Odoo Web Invalid Fields`, `Odoo Web Form Is Unsaved` | Save and get the record id, or a refusal naming its cause; drop pending changes; the fields marked invalid; whether the form holds unsaved changes |
174
- | `Add Odoo Web Line`, `Fill Odoo Web Line Field`, `Get Odoo Web Lines` | Add a line to a one2many field (the lines of a sales order), fill a field of the line in edition, read the lines once shown as stored |
175
- | `Click Odoo Web Form Button` | Press a button that calls a method of the record (`action_confirm`), by its technical name; waits until Odoo answered and reloaded the record; needs `allow_write`, journaled |
208
+ | `Add Odoo Web Line`, `Fill Odoo Web Line Field`, `Get Odoo Web Lines`, `Get Odoo Web Line Field Value`, `Delete Odoo Web Line` | Add a line to a one2many field (the lines of a sales order), a section or a note by its `display_type`; fill a field of the line in edition (the text of a section or a note on Odoo 16 and 19 alike); read the lines once shown as stored, with their type; read one field of a line, a number as a number in the user's format; delete a line by its position |
209
+ | `Delete Odoo Web Section` | Delete a section of a list of lines with the lines Odoo attaches to it, by its menu as Odoo 19 does (a subsection up to the next section or subsection); refused before any click on Odoo 16, whose delete button of a section removes its row alone |
210
+ | `Click Odoo Web Form Button` | Press a button that calls a method of the record (`action_confirm`), by its technical name, waiting until Odoo answered and reloaded the record (needs `allow_write`, journaled); or a button that opens a window action, by the action's external id, without writing |
211
+ | `Archive Odoo Web Record`, `Unarchive Odoo Web Record`, `Delete Odoo Web Record`, `Odoo Web Confirmation Is Open` | Archive, unarchive or delete the record of the form through its Actions menu, the entry told by its icon (Odoo 19) or by the place the code of Odoo gives it (Odoo 16), never by its label; Odoo's question accepted, or refused with `confirm=${FALSE}`; journaled, Odoo's refusal reported with the class of its exception; whether a question of Odoo is open |
212
+ | `Odoo Web Dialog Is Open`, `Fill Odoo Web Dialog Field`, `Get Odoo Web Dialog Field Value`, `Click Odoo Web Dialog Button`, `Close Odoo Web Dialog` | Work in the dialog a button opened (a wizard): whether one is shown, enter and read its fields on the wizard's model, press a button of its footer by its technical name (and its id when several share it; needs `allow_write`, journaled) and get the view it opens, close it without writing |
176
213
 
177
214
  `Create New Quotation` is a skeleton that only warns: do not rely on it.
178
215
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "robotframework-odoofx"
7
- version = "0.2.0"
7
+ version = "0.3.0"
8
8
  description = "ODOOFX: Robot Framework library for testing Odoo through its web client (Browser library) and its external API (XML-RPC up to Odoo 18, JSON-2 from Odoo 19), with opt-in journaled writes."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -40,8 +40,11 @@ dependencies = [
40
40
 
41
41
  [project.optional-dependencies]
42
42
  web = ["robotframework-browser>=20.0,<21"]
43
+ ntlm = ["requests_ntlm>=1.1"]
44
+ pdf = ["pypdf>=4.0"]
43
45
  all = [
44
46
  "robotframework-odoofx[web]",
47
+ "robotframework-odoofx[pdf]",
45
48
  ]
46
49
 
47
50
  [project.urls]
@@ -4,7 +4,7 @@ ODOOFX - Odoo test automation for Robot Framework.
4
4
  ORM, RPC/XML-RPC, UI web (Browser library), workflows.
5
5
  """
6
6
 
7
- __version__ = "0.2.0"
7
+ __version__ = "0.3.0"
8
8
  __author__ = "Cyril Montiel"
9
9
  __email__ = "cyril@montiel.me"
10
10
  __license__ = "Apache-2.0"
@@ -0,0 +1,160 @@
1
+ """The authenticated HTTP sessions of `OdooFxLibrary`, the session kinds of RequestsLibrary absorbed.
2
+
3
+ Derived from robotframework-requests 0.9.7 (``RequestsLibrary/SessionKeywords.py``, MIT License,
4
+ Copyright (c) 2016 Bulkan Evcimen), rewritten. Names, parameters and defaults are the upstream's. As for
5
+ `Create Session`: the timeout and cookies belong to the session, ``debug`` is inert, a Robot ``Secret`` is
6
+ accepted in ``headers`` and in the password of ``auth`` and revealed into the session only, and the log
7
+ of the creation names the kind of authentication, never its secret (the upstream wrote ``headers`` and
8
+ ``cookies`` in clear). Changed, by decision of the owner of 2026-11-07: `Create Client Cert Session`
9
+ refuses a missing ``client_certs`` before it registers anything, and takes the single path of a PEM that
10
+ holds both the certificate and the key as it is. NTLM needs the optional extra ``ntlm``
11
+ (``requests_ntlm``). The lab targets answer none of the handshakes. A unit test plays the Digest one against a
12
+ double that issues the challenge and checks the response; for NTLM and a client certificate the unit tests hold
13
+ only the part of the library (the NTLM authentication built from the domain, the user and the password, the
14
+ certificate handed to the transport): no NTLM exchange and no TLS presentation is played anywhere.
15
+ """
16
+
17
+ from typing import Any
18
+
19
+ import requests
20
+ from robot.api import logger
21
+ from robot.api.deco import keyword
22
+
23
+ from .http_log import masked_headers, masked_url
24
+ from .http_requests import revealed
25
+ from .http_sessions import DEFAULT_RETRY_METHOD_LIST
26
+
27
+
28
+ def ntlm_auth_class() -> Any:
29
+ """The ``HttpNtlmAuth`` class of ``requests_ntlm``, or an error that names the extra to install."""
30
+ try:
31
+ from requests_ntlm import HttpNtlmAuth
32
+ except ImportError:
33
+ raise AssertionError("requests_ntlm module not installed: install the extra robotframework-odoofx[ntlm]") \
34
+ from None
35
+ return HttpNtlmAuth
36
+
37
+
38
+ class OdooHttpAuthenticatedSessionKeywords:
39
+ """`Create Custom Session`, `Create Digest Session`, `Create Client Cert Session`, `Create Ntlm Session`."""
40
+
41
+ def _open_authenticated_session(self, kind: str, alias: str, url: str, auth: Any, secrets: set,
42
+ headers: Any, cookies: Any, timeout: Any, proxies: Any, verify: Any,
43
+ max_retries: Any, backoff_factor: Any, disable_warnings: Any,
44
+ retry_status_list: Any, retry_method_list: Any) -> requests.Session:
45
+ logger.info(f"Creating {kind} session {alias}: url={masked_url(url)}, headers={masked_headers(headers)}, "
46
+ f"auth={type(auth).__name__ if auth is not None else None}, timeout={timeout}, verify={verify}")
47
+ session = self._register_http_session(
48
+ alias, url, headers=revealed(headers, secrets), cookies=cookies, auth=auth, timeout=timeout,
49
+ proxies=proxies, verify=verify, max_retries=max_retries, backoff_factor=backoff_factor,
50
+ disable_warnings=disable_warnings, retry_status_list=retry_status_list,
51
+ retry_method_list=retry_method_list)
52
+ session.odoofx_secrets.update(secrets)
53
+ return session
54
+
55
+ @keyword("Create Custom Session")
56
+ def create_custom_session(self, alias, url, auth, headers={}, cookies={}, timeout=None, proxies=None,
57
+ verify=False, debug=0, max_retries=3, backoff_factor=0.10, disable_warnings=0,
58
+ retry_status_list=[], retry_method_list=DEFAULT_RETRY_METHOD_LIST):
59
+ """Create an HTTP session to ``url`` authenticated by ``auth``, any ``requests`` authentication.
60
+
61
+ ``auth`` is an object of ``requests.auth`` (``HTTPBasicAuth``, a
62
+ subclass of ``AuthBase``...), mounted on the session as given. The
63
+ other arguments are those of `Create Session`. Returns the session.
64
+
65
+ Example:
66
+ | ${basic}= Evaluate requests.auth.HTTPBasicAuth("odoofx-probe", "lot3")
67
+ | `Create Custom Session` custom-auth http://127.0.0.1:8016 ${basic}
68
+ | ${page}= `GET On Session` custom-auth /web/login
69
+ | Should Be Equal As Integers ${page.status_code} 200
70
+ """
71
+ secrets = set()
72
+ return self._open_authenticated_session(
73
+ "custom", alias, url, revealed(auth, secrets), secrets, headers, cookies, timeout, proxies, verify,
74
+ max_retries, backoff_factor, disable_warnings, retry_status_list, retry_method_list)
75
+
76
+ @keyword("Create Digest Session")
77
+ def create_digest_session(self, alias, url, auth, headers={}, cookies={}, timeout=None, proxies=None,
78
+ verify=False, debug=0, max_retries=3, backoff_factor=0.10, disable_warnings=0,
79
+ retry_status_list=[], retry_method_list=DEFAULT_RETRY_METHOD_LIST):
80
+ """Create an HTTP session to ``url`` with HTTP Digest authentication.
81
+
82
+ ``auth`` is a user name and a password (two elements; the upstream's
83
+ documentation said three, copied from NTLM), the password possibly a
84
+ Robot ``Secret``. The session answers a server's Digest challenge
85
+ (``401`` with ``WWW-Authenticate: Digest``); Odoo issues none, so on
86
+ the lab targets the session reaches Odoo without authenticating: the
87
+ handshake is held by a unit test. The other arguments are those of
88
+ `Create Session`. Returns the session.
89
+
90
+ Example:
91
+ | `Create Digest Session` digest-auth http://127.0.0.1:8016
92
+ | ... ${{["odoofx-probe", $PASSWORD]}}
93
+ | ${page}= `GET On Session` digest-auth /web/login
94
+ | Should Be True 'Authorization' not in $page.request.headers
95
+ """
96
+ secrets = set()
97
+ digest = requests.auth.HTTPDigestAuth(*revealed(auth, secrets)) if auth else None
98
+ return self._open_authenticated_session(
99
+ "digest", alias, url, digest, secrets, headers, cookies, timeout, proxies, verify, max_retries,
100
+ backoff_factor, disable_warnings, retry_status_list, retry_method_list)
101
+
102
+ @keyword("Create Client Cert Session")
103
+ def create_client_cert_session(self, alias, url, headers={}, cookies={}, client_certs=None, timeout=None,
104
+ proxies=None, verify=False, debug=0, max_retries=3, backoff_factor=0.10,
105
+ disable_warnings=0, retry_status_list=[],
106
+ retry_method_list=DEFAULT_RETRY_METHOD_LIST):
107
+ """Create an HTTP session to ``url`` that presents a client certificate over TLS.
108
+
109
+ ``client_certs`` is the pair of PEM files (certificate, key), or the
110
+ single path of a PEM holding both, taken as it is. Without it the
111
+ keyword fails before any session is registered (the upstream failed
112
+ after registering it). requests checks that the files exist before
113
+ each request, even over plain HTTP, where it never presents them: the
114
+ lab targets are HTTP, the TLS presentation is not verified there. The
115
+ other arguments are those of `Create Session`. Returns the session.
116
+
117
+ Example:
118
+ | ${pair}= Create List tests/data/http/streaming-upload-probe.txt tests/data/http/streaming-upload-probe.txt
119
+ | `Create Client Cert Session` client-cert http://127.0.0.1:8016 client_certs=${pair}
120
+ | ${page}= `GET On Session` client-cert /web/login
121
+ | Should Be Equal As Integers ${page.status_code} 200
122
+ | Run Keyword And Expect Error GLOB:*client_certs* `Create Client Cert Session` no-cert http://127.0.0.1:8016
123
+ """
124
+ if not client_certs:
125
+ raise ValueError("client_certs names the client certificate and its key: [certificate, key], "
126
+ "or the path of one PEM file holding both")
127
+ session = self._open_authenticated_session(
128
+ "client certificate", alias, url, None, set(), headers, cookies, timeout, proxies, verify, max_retries,
129
+ backoff_factor, disable_warnings, retry_status_list, retry_method_list)
130
+ session.cert = client_certs if isinstance(client_certs, str) else tuple(client_certs)
131
+ return session
132
+
133
+ @keyword("Create Ntlm Session")
134
+ def create_ntlm_session(self, alias, url, auth, headers={}, cookies={}, timeout=None, proxies=None,
135
+ verify=False, debug=0, max_retries=3, backoff_factor=0.10, disable_warnings=0,
136
+ retry_status_list=[], retry_method_list=DEFAULT_RETRY_METHOD_LIST):
137
+ """Create an HTTP session to ``url`` with NTLM authentication, behind the optional extra ``ntlm``.
138
+
139
+ ``auth`` is the domain, the user name and the password (three
140
+ elements, the password possibly a Robot ``Secret``), sent as
141
+ ``domain\\user``. Without ``requests_ntlm`` (``pip install
142
+ robotframework-odoofx[ntlm]``) the keyword fails before any session
143
+ is registered, its message starting as the upstream's (``requests_ntlm
144
+ module not installed``). No lab target answers NTLM: the handshake is
145
+ not verified live. The other arguments are those of `Create Session`.
146
+ Returns the session.
147
+
148
+ Example:
149
+ | Run Keyword And Expect Error GLOB:requests_ntlm module not installed*
150
+ | ... `Create Ntlm Session` ntlm-auth http://127.0.0.1:8016
151
+ | ... ${{["ODOOFX-PROBE", "odoofx-probe", $PASSWORD]}}
152
+ """
153
+ ntlm = ntlm_auth_class()
154
+ if len(auth) != 3:
155
+ raise AssertionError(f"Incorrect number of authentication arguments - expected 3, got {len(auth)}")
156
+ secrets = set()
157
+ domain, user, password = revealed(list(auth), secrets)
158
+ return self._open_authenticated_session(
159
+ "NTLM", alias, url, ntlm(f"{domain}\\{user}", password), secrets, headers, cookies, timeout, proxies,
160
+ verify, max_retries, backoff_factor, disable_warnings, retry_status_list, retry_method_list)
@@ -0,0 +1,15 @@
1
+ """The HTTP channel of `OdooFxLibrary`: sessions plain or authenticated, requests on a session or without one,
2
+ status assertions, the Odoo web session."""
3
+
4
+ from .http_authenticated_sessions import OdooHttpAuthenticatedSessionKeywords
5
+ from .http_odoo_session import OdooHttpOdooSessionKeywords
6
+ from .http_requests import OdooHttpRequestKeywords
7
+ from .http_requests_without_session import OdooHttpSessionLessRequestKeywords
8
+ from .http_sessions import OdooHttpSessionKeywords
9
+ from .http_status_assertions import OdooHttpStatusAssertionKeywords
10
+
11
+
12
+ class OdooHttpKeywords(OdooHttpSessionKeywords, OdooHttpAuthenticatedSessionKeywords, OdooHttpRequestKeywords,
13
+ OdooHttpSessionLessRequestKeywords, OdooHttpStatusAssertionKeywords,
14
+ OdooHttpOdooSessionKeywords):
15
+ """The HTTP keywords of `OdooFxLibrary`, mixed into it."""