Ver código fonte

[raz] Add test for no SAS token in RAZ ADLS response

Harshg999 4 anos atrás
pai
commit
81a3082b59

+ 1 - 1
desktop/core/src/desktop/lib/rest/raz_http_client.py

@@ -46,7 +46,7 @@ class RazHttpClient(HttpClient):
     response = raz_client.get_url(action=http_method, path=url, headers=headers)
 
     signed_url = url
-    if response.get('token') is not None:
+    if response.get('token'):
       signed_url += ('?' if '?' not in url else '&') + response.get('token')
 
     # Required because `self._make_url` is called in base class execute method also

+ 18 - 0
desktop/core/src/desktop/lib/rest/raz_http_client_test.py

@@ -55,3 +55,21 @@ class TestRazHttpClient():
             clear_cookies=False,
             timeout=120
         )
+
+        # When there is no SAS token in response
+        raz_get_url.return_value = {}
+        client = RazHttpClient(username='test', base_url='https://gethue.blob.core.windows.net')
+        f = client.execute(http_method='GET', path='/gethue/data/customer.csv', params={'action': 'getStatus'})
+
+        raz_http_execute.assert_called_with(
+            http_method='GET',
+            path='/gethue/data/customer.csv?action=getStatus',
+            data=None,
+            headers=None,
+            allow_redirects=False,
+            urlencode=False,
+            files=None,
+            stream=False,
+            clear_cookies=False,
+            timeout=120
+        )