def xlsx_blob_fixture(self, request, xlsx_file_, workbook_, worksheet_, _populate_worksheet_, _open_worksheet_, BytesIO_): workbook_writer = _BaseWorkbookWriter(None) xlsx_blob = 'fooblob' BytesIO_.return_value = xlsx_file_ # to make context manager behavior work _open_worksheet_.return_value.__enter__.return_value = (workbook_, worksheet_) xlsx_file_.getvalue.return_value = xlsx_blob return (workbook_writer, xlsx_file_, workbook_, worksheet_, xlsx_blob)
def xlsx_blob_fixture( self, request, xlsx_file_, workbook_, worksheet_, _populate_worksheet_, _open_worksheet_, BytesIO_): workbook_writer = _BaseWorkbookWriter(None) xlsx_blob = 'fooblob' BytesIO_.return_value = xlsx_file_ # to make context manager behavior work _open_worksheet_.return_value.__enter__.return_value = ( workbook_, worksheet_ ) xlsx_file_.getvalue.return_value = xlsx_blob return ( workbook_writer, xlsx_file_, workbook_, worksheet_, xlsx_blob )
def it_can_generate_a_chart_data_Excel_blob(self, request, xlsx_file_, workbook_, worksheet_, BytesIO_): _populate_worksheet_ = method_mock(request, _BaseWorkbookWriter, "_populate_worksheet") _open_worksheet_ = method_mock(request, _BaseWorkbookWriter, "_open_worksheet") # --- to make context manager behavior work --- _open_worksheet_.return_value.__enter__.return_value = (workbook_, worksheet_) BytesIO_.return_value = xlsx_file_ xlsx_file_.getvalue.return_value = b"xlsx-blob" workbook_writer = _BaseWorkbookWriter(None) xlsx_blob = workbook_writer.xlsx_blob _open_worksheet_.assert_called_once_with(workbook_writer, xlsx_file_) _populate_worksheet_.assert_called_once_with(workbook_writer, workbook_, worksheet_) assert xlsx_blob == b"xlsx-blob"
def populate_fixture(self): workbook_writer = _BaseWorkbookWriter(None) return workbook_writer
def open_fixture(self, xlsx_file_, workbook_, worksheet_, Workbook_): workbook_writer = _BaseWorkbookWriter(None) workbook_.add_worksheet.return_value = worksheet_ return workbook_writer, xlsx_file_, workbook_, worksheet_, Workbook_