← Back to team overview

openlp-core team mailing list archive

Re: [Merge] lp:~phill-ridout/openlp/worshipcenterpro_import into lp:openlp

 

Review: Needs Fixing

> # WHEN: pyodbc raises and unspecified exception
> mocked_pyodbc.connect.side_effect = Exception()
> 
> # THEN: doImport should return None, and pyodbc, translate & logError are called with known calls
> self.assertIsNone(importer.doImport(), u'doImport should return None when pyodbc raises an exception.')

Your WHEN is a GIVEN, and your first THEN is a WHEN.

    # WHEN: ...
    return_value = importer.doImport()

    # THEN: doImport should return None
    self.assertIsNone(return_value, ...)

Additionally, you should be raising the exact exception that pyodbc would raise. If the code just catches "Exception" then you should fix the code.

> # WHEN: the RECORDSET_TEST_DATA is simulated as fetched
> mocked_pyodbc.connect().cursor().fetchall.return_value = RECORDSET_TEST_DATA

Again, if you're setting a value to expect, it is a GIVEN, not a WHEN. A WHEN is an *action*.

And drop the brackets, they are unnecessary.
-- 
https://code.launchpad.net/~phill-ridout/openlp/worshipcenterpro_import/+merge/158974
Your team OpenLP Core is subscribed to branch lp:openlp.


Follow ups

References