浏览代码

[raz_adls] Add test for rename operation

Harshg999 4 年之前
父节点
当前提交
226dcf6d3f
共有 1 个文件被更改,包括 20 次插入0 次删除
  1. 20 0
      desktop/core/src/desktop/lib/raz/raz_client_test.py

+ 20 - 0
desktop/core/src/desktop/lib/raz/raz_client_test.py

@@ -273,6 +273,26 @@ class RazClientTest(unittest.TestCase):
     assert_equal(response['access_type'], 'set-permission')
     assert_equal(response['relative_path'], '/user/csso_hueuser/customers.csv')
 
+    # Rename
+    method = 'PUT'
+    relative_path = '/user/csso_hueuser/old_dir' # First call to fetch SAS to sign header path
+    url_params = {}
+
+    response = client.handle_adls_req_mapping(method, url_params, relative_path)
+
+    assert_equal(response['access_type'], 'rename-source')
+    assert_equal(response['relative_path'], '/user/csso_hueuser/old_dir')
+
+    method = 'PUT'
+    relative_path = '/user/csso_hueuser/new_dir' 
+    headers = {'x-ms-rename-source': '/user/csso_hueuser/old_dir?some_sas_token'} # Second call having signed header path
+    url_params = {}
+
+    response = client.handle_adls_req_mapping(method, url_params, relative_path)
+
+    assert_equal(response['access_type'], 'rename-source')
+    assert_equal(response['relative_path'], '/user/csso_hueuser/new_dir')
+
 
   def test_get_raz_client_s3(self):
     with patch('desktop.lib.raz.raz_client.RazToken') as RazToken: