def generate_default_reminders(count_item=3): """ Google Api documentation: https://developers.google.com/google-apps/calendar/v3/reference/calendarList minutes: Number of minutes before the start of the event when the reminder should trigger. Valid values are between 0 and 40320 (4 weeks in minutes). """ max_minutes = 40320 reminders = [] count = get_random_int(1, count_item) for i in range(count): reminders.append({ "method": get_random_list_element(['email', 'sms', 'popup']), "minutes": get_random_int(upper=max_minutes) }) return reminders
def create_random_model(self, email=None): """ :param email: if specified email on which messages send :return: BodyMessageModel object with random attributes """ email = "{0}@gmail.com" if email is None else email self.text = get_unique_string() self.to = email.format(get_unique_string()) self.from_ = email.format(get_unique_string()) list_emails = [] for i in range(0, get_random_int(1, 3)): list_emails.append(email.format(get_unique_string())) self.cc = list_emails self.bcc = email.format(get_unique_string()) return self
def create_model_calendar_list(self, calendar_id=None, summary_override=None, color_id=None, default_reminders=None, notification_settings=None): self.cal_id = calendar_id self.summary_override = summary_override or get_unique_string_from_template( "Summary_override_{0}") self.color_id = color_id or "{0}".format(get_random_int(1, 24)) self.default_reminders = default_reminders or self.generate_default_reminders( ) self.notification_settings = notification_settings or self.generate_notification_settings( ) return self
def get_random_messages_id_list(user_id): """ Return list with random messages id from existing messaged id list Args: user_id(str): user email Returns: messages_id_random_list(list): list with random count of messages id from existing messages id list """ ids_list = [] messages_id_random_list = [] for message in get_messages_list(user_id): ids_list.append(message.message_id) ids_count = get_random_int(1, len(ids_list)) for x in range(0, ids_count): random_id = get_random_list_element(ids_list) while random_id in messages_id_random_list: random_id = get_random_list_element(ids_list) messages_id_random_list.append(random_id) log_info("Messages id list contains " + str(len(messages_id_random_list)) + " random id values") return messages_id_random_list
def get_random_digit_value(lower, upper): return get_random_int(int(lower), int(upper))