Example #1
0
def step_impl(context, datum):
    url = context.custom_config[
        "host"] + 'api/accounting_system/report/?user[]=company&'
    date_dict = {
        "year": "",
        "month": "",
        "day": "",
    }

    if datum == 'non actual':
        variable_dates = prev_current_date()
        date_dict["year"] = variable_dates["current_year"]
        date_dict["month"] = variable_dates["current_month"]
        date_dict["day"] = 1
        context.new_bills = context.bills if datetime.today(
        ).day != 1 else context.modified_bills
    elif datum == 'actual':
        variable_dates = prev_current_date()
        date_dict["year"] = variable_dates["current_year"]
        date_dict["month"] = variable_dates["current_month"]
        date_dict["day"] = variable_dates["current_day"]
        context.new_bills = context.modified_bills

    account_url, context.picked_accounts = random_filter_generator(
        context.bill_list, 'account')

    context.url= url + account_url +\
          f'date={date_dict["year"]}-{date_dict["month"]}-{date_dict["day"]}'
Example #2
0
def step_impl(context):
    date_dict = prev_current_date()

    context.date_one = f'date_from={date_dict["prev_year"]}-{date_dict["prev_month"]}-25T00:00:00&' \
                       f'date_to={date_dict["prev_year"]}-{date_dict["prev_month"]}-26T00:00:00'
    context.date_two = f'date_from={date_dict["current_year"]}-{date_dict["current_month"]}-{date_dict["current_day"]}T00:00:00&' \
                       f'date_to={date_dict["current_year"]}-{date_dict["current_month"]}-{date_dict["current_day"]}T23:59:59'
Example #3
0
def step_impl(context, key, datum):
    url = context.custom_config["host"] + 'api/accounting_system/report/?'
    url_xlsx = context.custom_config[
        "host"] + 'api/accounting_system/report/?file_format=xlsx&'
    date_dict = {
        "year": "",
        "month": "",
        "day": "",
    }

    if datum == 'non actual':
        variable_dates = prev_current_date()
        date_dict["year"] = variable_dates["current_year"]
        date_dict["month"] = variable_dates["current_month"]
        date_dict["day"] = 1
        context.new_bills = context.bills if datetime.today(
        ).day != 1 else context.modified_bills
    elif datum == 'actual':
        variable_dates = prev_current_date()
        date_dict["year"] = variable_dates["current_year"]
        date_dict["month"] = variable_dates["current_month"]
        date_dict["day"] = variable_dates["current_day"]
        context.new_bills = context.modified_bills

    user_url_list = [f'user[]={i}&' for i in list(context.userdata.keys())]
    user_url = ''.join(user_url_list)

    account_url_list = [f'account[]={i}&' for i in context.bill_list]
    account_url = ''.join(account_url_list)

    field_url_list = [f'field[]={i}&' for i in context.report_fields_list]
    field_url = ''.join(field_url_list)

    if key == 'user':
        user_url, context.picked_users = random_filter_generator(
            list(context.userdata.keys()), 'user')
    elif key == 'account':
        account_url, context.picked_accounts = random_filter_generator(
            context.bill_list, 'account')
    elif key == 'field':
        field_url, context.picked_fields = random_filter_generator(
            context.report_fields_list, 'field')

    context.url= url + user_url + account_url + field_url +\
          f'date={date_dict["year"]}-{date_dict["month"]}-{date_dict["day"]}'
    context.url_xlsx = url_xlsx + user_url + account_url + field_url + \
                  f'date={date_dict["year"]}-{date_dict["month"]}-{date_dict["day"]}'
Example #4
0
def step_impl(context, key):
    url = context.custom_config["host"] + 'api/accounting_system/entries/?user[]=all&account[]=all&'

    date_dict = prev_current_date()
    if key == 'appropriate':
        url_date = f'date_from={date_dict["prev_year"]}-{date_dict["prev_month"]}-27T00:00:00&' \
                   f'date_to={date_dict["current_year"]}-{date_dict["current_month"]}-01T00:00:00'
    elif key == 'inappropriate':
        url_date = f'date_from={date_dict["prev_year"]}-{date_dict["prev_month"]}-24T00:00:00&' \
                   f'date_to={date_dict["prev_year"]}-{date_dict["prev_month"]}-26T00:00:00'
    context.url = url + url_date
Example #5
0
def step_impl(context):
    date_dict = prev_current_date()
    url_date = f'date_from={date_dict["prev_year"]}-{date_dict["prev_month"]}-28T00:00:00&' \
               f'date_to={date_dict["current_year"]}-{date_dict["current_month"]}-01T00:00:00'
    context.url += url_date