DB Test Cases - gpaOliveira/SuperDiffer GitHub Wiki

Obtained from file: SuperDiffer/tests/test_db.py

Test cases to verify and document the DB helpers behavior on the controller

[UNIT_TESTS] db count 1 method

  • Given no data is on the database
  • When a data is added to the model
  • Then the database count is raised properlly by 1

[UNIT_TESTS] db count 2 method

  • Given no data is on the database
  • When two new different IDs are added to the model
  • Then the database count is raised properlly by 2

[UNIT_TESTS] db count non unique id method

  • Given no data is on the database
  • When two new different descriptors for the ID are added to the model
  • Then the database count is raised properlly by 2

[UNIT_TESTS] db count unique description and id method

  • Given no data is on the database
  • When the same descriptor is added twice to an ID on the model
  • Then an IntegrityError is raised and the database count is raised only by 1

[UNIT_TESTS] db list 1 method

  • Given no data is on the database
  • When a data is added to the database model
  • Then a json representation of it is correctly returned

[UNIT_TESTS] db list 2 different ids method

  • Given no data is on the database
  • When two IDs are added to the database model
  • Then a json representation of them both is correctly returned

[UNIT_TESTS] db list 2 different descriptors method

  • Given no data is on the database
  • When two descriptors are added to the database model bound to the same ID
  • Then a json representation of them both is correctly returned