robotframework-mock 0.5.0__tar.gz → 0.6.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.
- {robotframework_mock-0.5.0/src/robotframework_mock.egg-info → robotframework_mock-0.6.0}/PKG-INFO +9 -1
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/README.md +8 -0
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/setup.cfg +1 -1
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/src/MockResource/__init__.py +12 -1
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0/src/robotframework_mock.egg-info}/PKG-INFO +9 -1
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/LICENSE +0 -0
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/MANIFEST.in +0 -0
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/pyproject.toml +0 -0
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/setup.py +0 -0
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/src/MockCoverage/__init__.py +0 -0
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/src/MockLibrary/__init__.py +0 -0
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/src/_mock_core/__init__.py +0 -0
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/src/robotframework_mock.egg-info/SOURCES.txt +0 -0
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/src/robotframework_mock.egg-info/dependency_links.txt +0 -0
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/src/robotframework_mock.egg-info/requires.txt +0 -0
- {robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/src/robotframework_mock.egg-info/top_level.txt +0 -0
{robotframework_mock-0.5.0/src/robotframework_mock.egg-info → robotframework_mock-0.6.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: robotframework-mock
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: A Robot Framework library for mocking keywords in unit tests
|
|
5
5
|
Home-page: https://github.com/olesz/robotframework-mock
|
|
6
6
|
Author: Lajos Olah
|
|
@@ -320,6 +320,14 @@ Mock a keyword with a return value or side effect.
|
|
|
320
320
|
MockDB.Mock Keyword query return_value=test_data
|
|
321
321
|
```
|
|
322
322
|
|
|
323
|
+
`return_value` may be any Python object, not only a string, so a keyword that
|
|
324
|
+
forwards a query result or a parsed response body can be mocked directly:
|
|
325
|
+
|
|
326
|
+
```robot
|
|
327
|
+
${rows}= Evaluate [['Europe/Budapest']]
|
|
328
|
+
MockRes.Mock Keyword Run Query return_value=${rows}
|
|
329
|
+
```
|
|
330
|
+
|
|
323
331
|
### Reset Mocks
|
|
324
332
|
|
|
325
333
|
Restore all mocked keywords to their original implementations.
|
|
@@ -296,6 +296,14 @@ Mock a keyword with a return value or side effect.
|
|
|
296
296
|
MockDB.Mock Keyword query return_value=test_data
|
|
297
297
|
```
|
|
298
298
|
|
|
299
|
+
`return_value` may be any Python object, not only a string, so a keyword that
|
|
300
|
+
forwards a query result or a parsed response body can be mocked directly:
|
|
301
|
+
|
|
302
|
+
```robot
|
|
303
|
+
${rows}= Evaluate [['Europe/Budapest']]
|
|
304
|
+
MockRes.Mock Keyword Run Query return_value=${rows}
|
|
305
|
+
```
|
|
306
|
+
|
|
299
307
|
### Reset Mocks
|
|
300
308
|
|
|
301
309
|
Restore all mocked keywords to their original implementations.
|
|
@@ -11,6 +11,13 @@ from robot.utils import split_from_equals
|
|
|
11
11
|
|
|
12
12
|
from _mock_core import CallInspectionMixin
|
|
13
13
|
|
|
14
|
+
# Robot resolves the values of a RETURN statement as variable expressions, so a
|
|
15
|
+
# mocked return value cannot be embedded in one directly - anything that is not
|
|
16
|
+
# a string raises a TypeError. The value is therefore published under this name
|
|
17
|
+
# and the injected RETURN refers to it, which lets a mock return any Python
|
|
18
|
+
# object (a query result set, a parsed JSON body, a list of pods...).
|
|
19
|
+
RETURN_VARIABLE = '${__mock_resource_return__}'
|
|
20
|
+
|
|
14
21
|
|
|
15
22
|
def _resolve_arguments(keyword_obj, data, context):
|
|
16
23
|
"""Split a keyword call's raw arguments into resolved args and kwargs.
|
|
@@ -90,7 +97,11 @@ class MockResource(CallInspectionMixin):
|
|
|
90
97
|
keyword_runner.keyword, data, context
|
|
91
98
|
)
|
|
92
99
|
mock_result = mock(*args, **kwargs)
|
|
93
|
-
|
|
100
|
+
# Test scope, so the value is visible to the keyword's own
|
|
101
|
+
# body even when the mocked keyword is called from inside
|
|
102
|
+
# another keyword rather than directly from the test.
|
|
103
|
+
context.variables.set_test(RETURN_VARIABLE, mock_result)
|
|
104
|
+
keyword_runner.keyword.body._items = [Return(values=[RETURN_VARIABLE])] # pylint: disable=protected-access
|
|
94
105
|
return original_run(data, result, context, run)
|
|
95
106
|
keyword_runner.run = patched_run
|
|
96
107
|
|
{robotframework_mock-0.5.0 → robotframework_mock-0.6.0/src/robotframework_mock.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: robotframework-mock
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: A Robot Framework library for mocking keywords in unit tests
|
|
5
5
|
Home-page: https://github.com/olesz/robotframework-mock
|
|
6
6
|
Author: Lajos Olah
|
|
@@ -320,6 +320,14 @@ Mock a keyword with a return value or side effect.
|
|
|
320
320
|
MockDB.Mock Keyword query return_value=test_data
|
|
321
321
|
```
|
|
322
322
|
|
|
323
|
+
`return_value` may be any Python object, not only a string, so a keyword that
|
|
324
|
+
forwards a query result or a parsed response body can be mocked directly:
|
|
325
|
+
|
|
326
|
+
```robot
|
|
327
|
+
${rows}= Evaluate [['Europe/Budapest']]
|
|
328
|
+
MockRes.Mock Keyword Run Query return_value=${rows}
|
|
329
|
+
```
|
|
330
|
+
|
|
323
331
|
### Reset Mocks
|
|
324
332
|
|
|
325
333
|
Restore all mocked keywords to their original implementations.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robotframework_mock-0.5.0 → robotframework_mock-0.6.0}/src/robotframework_mock.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|