def test_write_data(self, m_open): mock_fp = Mock() mock_fp.__enter__ = lambda x: mock_fp mock_fp.__exit__ = lambda w, x, y, z: None m_open.return_value = mock_fp c.write_to_file('data', 'outfile') m_open.assert_called_once_with('outfile', 'w') mock_fp.write.assert_called_once_with('data')
def write_html_to_disk(b, outfile): html = b.get_html() fs_common.write_to_file(html, outfile)