def step_impl(context): factory = RequestFactory() kwargs = {"cost_centre": TEST_COST_CENTRE_CODE} request = factory.get( reverse( "export_edit_forecast_data_cost_centre", kwargs=kwargs, )) request.user = context.user response = export_edit_forecast_data(request, **kwargs) assert response.status_code == 200 file = io.BytesIO(response.content) wb = load_workbook( filename=file, read_only=True, data_only=True, ) ws = wb.active paste_text = "" for row in ws.rows: for cell in row: value = cell.value or "\t" paste_text += f"{value}\t" paste_text += "\\n" copy_text(context, paste_text) paste(context)
def step_impl(context): april = FinancialPeriod.objects.filter(period_long_name="April").first() april.actual_loaded = True april.save() paste_text = "123456 Test 111111 Test 1111111 2222222 3000 0 1000.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00\\n999999 Test 123456 Test 1111111 2222222 3000 0 1000.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00" copy_text(context, paste_text) paste(context) april.actual_loaded = False april.save()
def step_impl(context): paste_text = "123456 Test 111111 Test 1111111 2222222 3000 0 1000.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00\\n123456 Test 999999 Test 1111111 2222222 3000 0 1000.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00" copy_text(context, paste_text) paste(context)
def step_impl(context): paste_text = "111111 Test 333444 Test 1111111 2222222 3000 0 1000.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00" copy_text(context, paste_text) paste(context)
def step_impl(context): error_paste_text = "This is a mistake..." copy_text(context, error_paste_text) paste(context)
def step_impl(context): too_many_rows_paste_text = "123456 Test 111111 Test 1111111 2222222 3000 0 1000.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00\\n123456 Test 999999 Test 1111111 2222222 3000 0 1000.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00\\n123456 Test n333333 Test 1111111 2222222 3000 0 1000.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00" copy_text(context, too_many_rows_paste_text) paste(context)
def step_impl(context): paste_text = "Natural Account code Programme code Description Programme code Natural Account Code Description Contract Code Market Code Project Code Budget Apr May Jun Jul Aug Sep Oct Nov Dec Jan Feb Mar Forecast outturn Variance -overspend/underspend Year to Date Actuals Group name Group code Directorate name Directorate code Cost Centre name Cost Centre code Budget Grouping Expenditure type Expenditure type description Budget type Budget Category Budget/Forecast NAC Budget/Forecast NAC Description NAC Expenditure Type Contract Description Market Description Project Description" paste_text += "\\n123456 Test 111111 Test 1111111 2222222 3000 0 1000.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00\\n123456 Test 999999 Test 1111111 2222222 3000 0 1000.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00" copy_text(context, paste_text) paste(context)