Add API functional tests
ClosedPublic

Authored by mkrizek on Apr 18 2014, 1:38 PM.

Details

Summary

It doesn't cover the whole thing (about 71%, says pytest-cov) but should suffice I guess.

Fixes T137

Test Plan

Itself :)

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
mkrizek added inline comments.Apr 18 2014, 1:47 PM
resultsdb/models/results.py
45 ↗(On Diff #167)

This is from D61 and shouldn't be here. I did arc diff --create feature/T134schemafix and added dependency here but it still shows up in diff here, not sure why...

tflink requested changes to this revision.Apr 18 2014, 3:07 PM

Overall, the content looks good to me. However, I'd like to see all the monkeypatch statements go away. If you use setup_class() instead of setup_method(), the code is run for the class once instead of before every method.

@classmethod
def setup_class(cls):
    resultsdb.db.db_url = 'sqlite://'
    # other setup

That way, you can get rid of the monkeypatches, use an in-memory database for speed and not have to deal with all the tempfiles. The in-memory thing isn't as important as getting rid of the monkeypatches, though.

testing/functest_api.py
32

you can create a sqlite in-memory database using the url sqlite://. Using an in-memory database should make the tests go faster

mkrizek updated this revision.Apr 22 2014, 7:11 AM
  • Use in-memory db in functest
mkrizek updated this revision.Apr 22 2014, 8:36 AM
  • Remove unused imports
tflink accepted this revision.Apr 22 2014, 1:25 PM

Looks good to me

mkrizek closed this revision.May 12 2014, 9:06 AM

Closed by commit rRSDB5b3ad1fc1007 (authored by @mkrizek).