robotframework-openapitools 0.1.3__py3-none-any.whl → 0.2.0__py3-none-any.whl

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.
@@ -109,7 +109,25 @@ class OpenApiExecutors(OpenApiLibCore): # pylint: disable=too-many-instance-att
109
109
  url=url,
110
110
  verify=False,
111
111
  )
112
- assert response.status_code == 401
112
+ if response.status_code != 401:
113
+ raise AssertionError(f"Response {response.status_code} was not 401.")
114
+
115
+ @keyword
116
+ def test_forbidden(self, path: str, method: str) -> None:
117
+ """
118
+ Perform a request for `method` on the `path`, with the provided authorization.
119
+
120
+ This keyword only passes if the response code is 403: Forbidden.
121
+
122
+ For this keyword to pass, the authorization parameters used to initialize the
123
+ library should grant insufficient access rights to the target endpoint.
124
+ > Note: No headers or (json) body are send with the request. For security
125
+ reasons, the access rights validation should be checked first.
126
+ """
127
+ url: str = run_keyword("get_valid_url", path, method)
128
+ response: Response = run_keyword("authorized_request", url, method)
129
+ if response.status_code != 403:
130
+ raise AssertionError(f"Response {response.status_code} was not 403.")
113
131
 
114
132
  @keyword
115
133
  def test_invalid_url(
@@ -260,9 +278,7 @@ class OpenApiExecutors(OpenApiLibCore): # pylint: disable=too-many-instance-att
260
278
  params = request_data.get_required_params()
261
279
  headers = request_data.get_required_headers()
262
280
  json_data = (
263
- request_data.get_required_properties_dict()
264
- if request_data.has_body
265
- else None
281
+ request_data.get_minimal_body_dict() if request_data.has_body else None
266
282
  )
267
283
  original_data = None
268
284
  if method == "PATCH":
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <keywordspec name="OpenApiDriver" type="LIBRARY" format="HTML" scope="SUITE" generated="2024-04-05T14:47:49+00:00" specversion="5" source="/workspaces/robotframework-openapitools/src/OpenApiDriver/openapidriver.py" lineno="352">
3
- <version>0.1.3</version>
2
+ <keywordspec name="OpenApiDriver" type="LIBRARY" format="HTML" scope="SUITE" generated="2024-04-12T13:08:14+00:00" specversion="5" source="/workspaces/robotframework-openapitools/src/OpenApiDriver/openapidriver.py" lineno="352">
3
+ <version>0.2.0</version>
4
4
  <doc>&lt;p&gt;Visit the &lt;a href="https://github.com/MarketSquare/robotframework-openapidriver"&gt;library page&lt;/a&gt; for an introduction and examples.&lt;/p&gt;</doc>
5
5
  <tags>
6
6
  </tags>
@@ -199,7 +199,7 @@
199
199
  </init>
200
200
  </inits>
201
201
  <keywords>
202
- <kw name="Test Endpoint" source="/workspaces/robotframework-openapitools/src/OpenApiDriver/openapi_executors.py" lineno="157">
202
+ <kw name="Test Endpoint" source="/workspaces/robotframework-openapitools/src/OpenApiDriver/openapi_executors.py" lineno="175">
203
203
  <arguments repr="path: str, method: str, status_code: int">
204
204
  <arg kind="POSITIONAL_OR_NAMED" required="true" repr="path: str">
205
205
  <name>path</name>
@@ -219,7 +219,23 @@
219
219
  &lt;p&gt;The keyword calls other keywords to generate the neccesary data to perform the desired operation and validate the response against the openapi document.&lt;/p&gt;</doc>
220
220
  <shortdoc>Validate that performing the `method` operation on `path` results in a `status_code` response.</shortdoc>
221
221
  </kw>
222
- <kw name="Test Invalid Url" source="/workspaces/robotframework-openapitools/src/OpenApiDriver/openapi_executors.py" lineno="115">
222
+ <kw name="Test Forbidden" source="/workspaces/robotframework-openapitools/src/OpenApiDriver/openapi_executors.py" lineno="116">
223
+ <arguments repr="path: str, method: str">
224
+ <arg kind="POSITIONAL_OR_NAMED" required="true" repr="path: str">
225
+ <name>path</name>
226
+ <type name="str" typedoc="string">str</type>
227
+ </arg>
228
+ <arg kind="POSITIONAL_OR_NAMED" required="true" repr="method: str">
229
+ <name>method</name>
230
+ <type name="str" typedoc="string">str</type>
231
+ </arg>
232
+ </arguments>
233
+ <doc>&lt;p&gt;Perform a request for &lt;span class="name"&gt;method&lt;/span&gt; on the &lt;a href="#type-Path" class="name"&gt;path&lt;/a&gt;, with the provided authorization.&lt;/p&gt;
234
+ &lt;p&gt;This keyword only passes if the response code is 403: Forbidden.&lt;/p&gt;
235
+ &lt;p&gt;For this keyword to pass, the authorization parameters used to initialize the library should grant insufficient access rights to the target endpoint. &amp;gt; Note: No headers or (json) body are send with the request. For security reasons, the access rights validation should be checked first.&lt;/p&gt;</doc>
236
+ <shortdoc>Perform a request for `method` on the `path`, with the provided authorization.</shortdoc>
237
+ </kw>
238
+ <kw name="Test Invalid Url" source="/workspaces/robotframework-openapitools/src/OpenApiDriver/openapi_executors.py" lineno="133">
223
239
  <arguments repr="path: str, method: str, expected_status_code: int = 404">
224
240
  <arg kind="POSITIONAL_OR_NAMED" required="true" repr="path: str">
225
241
  <name>path</name>
@@ -361,6 +377,7 @@
361
377
  <usages>
362
378
  <usage>__init__</usage>
363
379
  <usage>Test Endpoint</usage>
380
+ <usage>Test Forbidden</usage>
364
381
  <usage>Test Invalid Url</usage>
365
382
  <usage>Test Unauthorized</usage>
366
383
  </usages>