Skip to content

Commit 106c040

Browse files
committed
add no auth header detail
1 parent 9ea1b2a commit 106c040

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,10 @@ class RDPHTTPController():
580580

581581
The ```rdp_request_esg()``` method above just create the request message payload, and send it to the RDP ESG service as HTTP GET request with the Requests ```requests.get()``` method. The return values can be as follows
582582
- If the request success (HTTP status is 200), returns the response data in JSON message format.
583-
- If the URL or credentials parameters are empty or none, raise the TypeError exception to the caller.
583+
- If the URL or access token, or universe values are empty or none, raise the TypeError exception to the caller.
584584
- If the request fails, raise the Requests' HTTPError exception to the caller with HTTP status response information.
585585

586+
586587
### Testing a valid RDP ESG Request-Response
587588

588589
The first test case is the request success scenario. I will begin by creating a fixture file with a valid ESG dummy response message. A file is *rdp_test_esg_fixture.json* in a *tests/fixtures* folder.
@@ -782,6 +783,9 @@ class TestRDPHTTPController(unittest.TestCase):
782783
self.assertIn('status', json_error['error'])
783784
784785
```
786+
The other common RDP APIs failure scenarios is the application sends the request message to RDP without the access token in the HTTP request' header. However, the *access token* is one of the ```rdp_request_esg()``` method required parameters. If the access token is not presented (None or Empty), the method raise the TypeError exception and not send HTTP request message to the RDP. The ```test_request_esg_none_empty()``` method is the one that covers this test case.
787+
788+
785789
### Testing Requesting RDP ESG data with an invalid item
786790

787791
Now we come to other common test cases, what if users request invalid item name data from the RDP ESG service? We can use a mock object to simulate invalid item request-response messages too.
@@ -845,7 +849,7 @@ That covers all I wanted to say about unit testing the HTTP requests for the RDP
845849
The source code that uses the Request library ```requests.post()``` method to send HTTP POST request message to the RDP Search Explore is available at the ```rdp_request_search_explore()``` method of the ```rdp_controller/rdp_http_controller.py``` class.
846850

847851
The test cases for this ```rdp_request_search_explore()``` method have the same testing and mocking logic as all previous cases that I have mentions above. You can find more details in the following test cases methods:
848-
- ```test_request_search_explore()```` method: Unit testing a valid request-response
852+
- ```test_request_search_explore()``` method: Unit testing a valid request-response
849853
- ```test_request_search_explore_token_expire()``` method: Unit testing a token expired case
850854
- ```test_request_search_explore_invalid_ric()``` method: Unit testing an invalid ric case
851855
- ```test_request_search_explore_invalid_json()``` method: Unit testing an invalid JSON post message case

0 commit comments

Comments
 (0)