@@ -114,7 +114,7 @@ def test_stage_copy_remote_to_local_quoted_stage_recursive(
114
114
):
115
115
mock_execute .side_effect = [
116
116
mock_cursor ([{"name" : '"stage name"/file' }], []),
117
- mock_cursor ([( "file" ) ], ["file" ]),
117
+ mock_cursor (["file" ], ["file" ]),
118
118
]
119
119
with TemporaryDirectory () as tmp_dir :
120
120
result = runner .invoke (
@@ -191,7 +191,7 @@ def test_stage_copy_remote_to_local_quoted_uri_recursive(
191
191
):
192
192
mock_execute .side_effect = [
193
193
mock_cursor ([{"name" : "stageName/file.py" }], []),
194
- mock_cursor ([( raw_path ) ], ["file" ]),
194
+ mock_cursor ([raw_path ], ["file" ]),
195
195
]
196
196
with TemporaryDirectory () as tmp_dir :
197
197
tmp_dir = Path (tmp_dir ).resolve ()
@@ -516,17 +516,41 @@ def test_stage_create(mock_execute, runner, mock_cursor):
516
516
result = runner .invoke (["stage" , "create" , "-c" , "empty" , "stageName" ])
517
517
assert result .exit_code == 0 , result .output
518
518
mock_execute .assert_called_once_with (
519
- "create stage if not exists IDENTIFIER('stageName')"
519
+ "create stage if not exists IDENTIFIER('stageName') encryption = (type = 'SNOWFLAKE_FULL') "
520
520
)
521
521
522
522
523
+ @mock .patch (f"{ STAGE_MANAGER } .execute_query" )
524
+ def test_stage_create_encryption (mock_execute , runner , mock_cursor ):
525
+ mock_execute .return_value = mock_cursor (["row" ], [])
526
+ for encryption in ["SNOWFLAKE_SSE" , "SNOWFLAKE_FULL" ]:
527
+ result = runner .invoke (
528
+ ["stage" , "create" , '"stage name"' , "--encryption" , encryption ]
529
+ )
530
+ assert result .exit_code == 0 , result .output
531
+ mock_execute .assert_called_once_with (
532
+ f"""create stage if not exists IDENTIFIER('"stage name"') encryption = (type = '{ encryption } ')"""
533
+ )
534
+ mock_execute .reset_mock ()
535
+
536
+ result = runner .invoke (
537
+ ["stage" , "create" , '"stage name"' , "--encryption" , "incorrect_encryption" ]
538
+ )
539
+ assert result .exit_code == 2 , result .output
540
+ assert (
541
+ "Invalid value for '--encryption': 'incorrect_encryption' is not one of"
542
+ in result .output
543
+ )
544
+ assert "'SNOWFLAKE_FULL', 'SNOWFLAKE_SSE'." in result .output
545
+
546
+
523
547
@mock .patch (f"{ STAGE_MANAGER } .execute_query" )
524
548
def test_stage_create_quoted (mock_execute , runner , mock_cursor ):
525
549
mock_execute .return_value = mock_cursor (["row" ], [])
526
550
result = runner .invoke (["stage" , "create" , "-c" , "empty" , '"stage name"' ])
527
551
assert result .exit_code == 0 , result .output
528
552
mock_execute .assert_called_once_with (
529
- """create stage if not exists IDENTIFIER('"stage name"')"""
553
+ """create stage if not exists IDENTIFIER('"stage name"') encryption = (type = 'SNOWFLAKE_FULL') """
530
554
)
531
555
532
556
0 commit comments