99
1010from helpers .SetupClientHelper import get_resource_path , get_temp_resource_path
1111from helpers .SyncHelper import (
12- wait_for_client_to_be_ready ,
1312 listen_sync_status_for_item ,
1413)
1514from helpers .Utils import wait_for
@@ -72,14 +71,12 @@ def write_file(resource, content):
7271 f .write (content )
7372
7473
75- def wait_and_write_file (path , content ):
76- wait_for_client_to_be_ready ()
74+ def write_file_to_sync_path (path , content ):
7775 listen_sync_status_for_item (get_resource_path (path ), 'FILE' )
7876 write_file (path , content )
7977
8078
81- def wait_and_try_to_write_file (resource , content ):
82- wait_for_client_to_be_ready ()
79+ def try_to_write_file (resource , content ):
8380 listen_sync_status_for_item (get_resource_path (resource ), 'FILE' )
8481 try :
8582 write_file (resource , content )
@@ -120,7 +117,6 @@ def copy_resource(resource_type, source, destination, from_files_for_upload=Fals
120117 if source == destination and destination != '/' :
121118 destination = add_copy_suffix (source , resource_type )
122119
123- wait_for_client_to_be_ready ()
124120 listen_sync_status_for_item (destination , resource_type )
125121 if resource_type == 'folder' :
126122 return shutil .copytree (source , destination )
@@ -134,13 +130,11 @@ def move_resource(username, resource_type, source, destination, is_temp_folder=F
134130 destination = ''
135131 destination = get_resource_path (destination , username )
136132
137- wait_for_client_to_be_ready ()
138133 listen_sync_status_for_item (destination , resource_type )
139134 shutil .move (source , destination )
140135
141136
142137def deleteResource (resource , resource_type ):
143- wait_for_client_to_be_ready ()
144138 listen_sync_status_for_item (resource , resource_type )
145139 resource_path = sanitize_path (get_resource_path (resource ))
146140 if resource_type == 'file' :
@@ -154,12 +148,11 @@ def deleteResource(resource, resource_type):
154148)
155149def step (context , username , filename ):
156150 file = get_resource_path (filename , username )
157- wait_and_write_file (convert_path_separators_for_os (file ), context .text )
151+ write_file_to_sync_path (convert_path_separators_for_os (file ), context .text )
158152
159153
160154@When ('user "{username}" creates a folder "{foldername}" inside the sync folder' )
161155def step (context , username , foldername ):
162- wait_for_client_to_be_ready ()
163156 create_folder (foldername , username )
164157
165158
@@ -190,7 +183,6 @@ def step(context, resource_type, resource_name):
190183@When ('the user renames a file "{source}" to "{destination}"' )
191184@When ('the user renames a folder "{source}" to "{destination}"' )
192185def step (context , source , destination ):
193- wait_for_client_to_be_ready ()
194186 rename_file_folder (source , destination )
195187
196188
@@ -245,7 +237,7 @@ def step(context, resource_type, resource):
245237@Given ('the user has changed the content of local file "{filename}" to:' )
246238def step (context , filename ):
247239 file_content = context .text
248- wait_and_write_file (get_resource_path (filename ), file_content )
240+ write_file_to_sync_path (get_resource_path (filename ), file_content )
249241
250242
251243@Then (
@@ -273,19 +265,19 @@ def step(context, filename):
273265@When ('the user overwrites the file "{resource}" with content "{content}"' )
274266def step (context , resource , content ):
275267 resource = get_resource_path (resource )
276- wait_and_write_file (resource , content )
268+ write_file_to_sync_path (resource , content )
277269
278270
279271@When ('the user tries to overwrite the file "|any|" with content "|any|"' )
280272def step (context , resource , content ):
281273 resource = get_resource_path (resource )
282- wait_and_try_to_write_file (resource , content )
274+ try_to_write_file (resource , content )
283275
284276
285277@When ('user "|any|" tries to overwrite the file "|any|" with content "|any|"' )
286278def step (context , user , resource , content ):
287279 resource = get_resource_path (resource , user )
288- wait_and_try_to_write_file (resource , content )
280+ try_to_write_file (resource , content )
289281
290282
291283@When ('the user deletes the {resource_type:ResourceType} "{resource_name}"' )
@@ -297,7 +289,7 @@ def step(context, resource_type, resource_name):
297289def step (context , username ):
298290 for row in context .table :
299291 file = get_resource_path (row [0 ], username )
300- wait_and_write_file (file , '' )
292+ write_file_to_sync_path (file , '' )
301293
302294
303295@Given ('the user has created a folder "{folder_name}" in temp folder' )
@@ -414,7 +406,6 @@ def step(context, username, zip_file_name):
414406
415407@When ('user "|any|" copies file "|any|" to temp folder' )
416408def step (context , username , source ):
417- wait_for_client_to_be_ready ()
418409 source_dir = get_resource_path (source , username )
419410 destination_dir = get_temp_resource_path (source )
420411 shutil .copy2 (source_dir , destination_dir )
@@ -447,7 +438,6 @@ def step(context, resource_name, destination):
447438
448439@When ('the user deletes the following files' )
449440def step (context ):
450- wait_for_client_to_be_ready ()
451441 for row in context .table :
452442 filename = row [0 ]
453443 deleteResource (filename , 'file' )
0 commit comments