66
77import pytest
88
9- from upload_all import glob_output_files , Args , parse_args , upload_images_to_openstack , upload_single_image , main , \
10- get_upload_name
9+ from upload_all import (
10+ glob_output_files ,
11+ Args ,
12+ parse_args ,
13+ upload_images_to_openstack ,
14+ upload_single_image ,
15+ main ,
16+ get_upload_name ,
17+ )
1118
1219
1320def test_glob_output_files (tmp_path ):
@@ -92,7 +99,8 @@ def _expected_args_helper(file: Path, visibility: str) -> Dict:
9299 "disk_format" : "qcow2" ,
93100 "container_format" : "bare" ,
94101 "wait" : True ,
95- "visibility" : visibility }
102+ "visibility" : visibility ,
103+ }
96104
97105
98106def test_upload_images_to_openstack_real_run ():
@@ -107,9 +115,10 @@ def test_upload_images_to_openstack_real_run():
107115 upload_images_to_openstack (expected_files , args )
108116
109117 assert mocked_upload_single_image .call_count == 2
110- expected = [call (
111- args .os_cloud ,
112- _expected_args_helper (file , "public" )) for file in expected_files ]
118+ expected = [
119+ call (args .os_cloud , _expected_args_helper (file , "public" ))
120+ for file in expected_files
121+ ]
113122 assert mocked_upload_single_image .call_args_list == expected
114123
115124
@@ -123,9 +132,7 @@ def test_upload_images_with_private_annotation():
123132 upload_images_to_openstack ([Path ("file1" )], args )
124133
125134 assert mocked_upload_single_image .call_count == 1
126- expected = [call (
127- args .os_cloud ,
128- _expected_args_helper (Path ("file1" ), "private" ))]
135+ expected = [call (args .os_cloud , _expected_args_helper (Path ("file1" ), "private" ))]
129136 assert mocked_upload_single_image .call_args_list == expected
130137
131138
@@ -139,7 +146,9 @@ def test_upload_single_image():
139146 upload_single_image ("fake_cloud" , fake_args )
140147
141148 mocked_openstack_connect .assert_called_once_with (cloud = "fake_cloud" )
142- mocked_openstack_connect .return_value .create_image .assert_called_once_with (** fake_args )
149+ mocked_openstack_connect .return_value .create_image .assert_called_once_with (
150+ ** fake_args
151+ )
143152
144153
145154def test_get_upload_name ():
0 commit comments