def __load_test(self, sharing_space, manifest_count, note_count, busy_wait_cycle, acceptable_invalids): self.__load_finished = False collection_name1 = 'sharing_col1' collection_name2 = 'sharing_col2' self.__create_collection(self.__account_id, collection_name1) self.__create_collection(self.__subscriber_id, collection_name2) action_list = [] sharing_template_file = open('../test_resources/sharing_template1.xml') sharing_template_str = sharing_template_file.read() manifest_str_list = MockFactory.get_list_of_different_strings(manifest_count, sharing_template_str) counter = 0 last_manifest = None for x in range(manifest_count): for manifest_str in manifest_str_list: last_manifest = manifest_str + str(x) manifest_file1 = cStringIO.StringIO(last_manifest) manifest_file2 = cStringIO.StringIO(last_manifest) name = str(counter) counter += 1 action1 = UpdateSharedManifestAction(self.__account_id, collection_name1, manifest_file1) action1.name = 'user1-manifest-' + name action2 = UpdateSharedManifestAction(self.__subscriber_id, collection_name2, manifest_file2) action2.name = 'user2-manifest-' + name action_list.append(action1) action_list.append(action2) #add some notes and images note_str_list = MockFactory.get_list_of_different_strings(note_count, sharing_template_str) file_name_counter = 0 note_names = [] for note_str in note_str_list : note_name = 'note' + str(file_name_counter) file_name_counter += 1 note_names.append(note_name) file_obj1 = cStringIO.StringIO(note_str) file_obj2 = cStringIO.StringIO(note_str) action1 = UpdateSharedNoteAction(self.__account_id, collection_name1, note_name, file_obj1) action1.name = 'user1-update-note-' + note_name action2 = UpdateSharedNoteAction(self.__subscriber_id, collection_name2, note_name, file_obj2) action2.name = 'user2-update-note-' + note_name action_list.append(action1) action_list.append(action2) img_file1 = open('../test_resources/sharing_note_img1.jpg', 'rb') img_file_like1 = cStringIO.StringIO(img_file1.read()) img_file2 = open('../test_resources/sharing_note_img2.jpg', 'rb') img_file_like2 = cStringIO.StringIO(img_file2.read()) action3 = UpdateSharedNoteImageAction(self.__account_id, collection_name1, note_name, img_file_like1) action3.name = 'user1-update-img-' + note_name action4 = UpdateSharedNoteImageAction(self.__subscriber_id, collection_name2, note_name, img_file_like2) action4.name = 'user2-update-img-' + note_name action_list.append(action3) action_list.append(action4) for action in action_list: sharing_space.add_action(action) #cleanup self.__remove_collection(self.__account_id, collection_name1) self.__remove_collection(self.__subscriber_id, collection_name2)