tests.unit_tests.db.test_yawning_titan_db#

This test module tests the YawningTitanDB class using the DemoDB subclass.

Functions

demo_db_docs

A basic list of docs with the structure.

test_all

Test the YawningTitanDB.insert and YawningTitanDB.all functions.

test_count

Test the YawningTitanDB.count function.

test_get

Test the awningTitanDB.get function.

test_get_with_uuid_multiple_fails

Test YawningTitanDB.get_with_uuid function fails with duplicate uuid's.

test_insert_existing_uuid_fails

Test YawningTitanDB.insert function fails with duplicate uuid's.

test_remove

Test the YawningTitanDB.remove function.

test_remove_locked_fails

Test the YawningTitanDB.remove function fails when removing a locked entry.

test_remove_with_uuid

Test the YawningTitanDB.remove_with_uuid function.

test_remove_with_uuid_multiple_fails

Test YawningTitanDB.remove_with_uuid function fails with duplicate uuid's.

test_search

Test the YawningTitanDB.search function.

test_update

Test the YawningTitanDB.insert and YawningTitanDB.update functions.

test_update_locked_fails

Test the YawningTitanDB.update function fails when updating a locked entry.

test_update_metadata

Test the YawningTitanDB.update function with new metadata.

test_upsert_insert

Test the YawningTitanDB.upsert function with a new insert.

test_upsert_update

Test the YawningTitanDB.upsert function with an update.

Classes

DemoDB

An implementation of YawningTitanDB.

DemoSchema

A schema-like class that defines the DB fields in demo_db_docs().

tests.unit_tests.db.test_yawning_titan_db.demo_db_docs()[source]#

A basic list of docs with the structure.

  • forename: str

  • surname: str

  • age: int

  • hobbies: List[str]

class tests.unit_tests.db.test_yawning_titan_db.DemoSchema[source]#

A schema-like class that defines the DB fields in demo_db_docs().

class tests.unit_tests.db.test_yawning_titan_db.DemoDB(name)[source]#

An implementation of YawningTitanDB.

__init__(name)[source]#
insert(doc, name=None, description=None, author=None)[source]#

Insert a doc and return the inserted doc.

all()[source]#

Get all docs.

get(uuid)[source]#

Get a dog from its uuid.

search(query)[source]#

Search for docs using Query.

update(doc, uuid, name=None, description=None, author=None)[source]#

Update a doc by uuid.

upsert(doc, uuid, name=None, description=None, author=None)[source]#

Upsert a doc by uuid.

remove_by_cond(cond)[source]#

Remove documents matching a query.

remove(uuid)[source]#

Remove a document with a given uuid.

tests.unit_tests.db.test_yawning_titan_db.test_all(demo_db_docs)[source]#

Test the YawningTitanDB.insert and YawningTitanDB.all functions.

tests.unit_tests.db.test_yawning_titan_db.test_get(demo_db_docs)[source]#

Test the awningTitanDB.get function.

Test the YawningTitanDB.search function.

tests.unit_tests.db.test_yawning_titan_db.test_count(demo_db_docs)[source]#

Test the YawningTitanDB.count function.

tests.unit_tests.db.test_yawning_titan_db.test_insert_existing_uuid_fails(demo_db_docs)[source]#

Test YawningTitanDB.insert function fails with duplicate uuid’s.

tests.unit_tests.db.test_yawning_titan_db.test_get_with_uuid_multiple_fails(demo_db_docs)[source]#

Test YawningTitanDB.get_with_uuid function fails with duplicate uuid’s.

tests.unit_tests.db.test_yawning_titan_db.test_update(demo_db_docs)[source]#

Test the YawningTitanDB.insert and YawningTitanDB.update functions.

tests.unit_tests.db.test_yawning_titan_db.test_update_metadata(demo_db_docs)[source]#

Test the YawningTitanDB.update function with new metadata.

tests.unit_tests.db.test_yawning_titan_db.test_update_locked_fails(demo_db_docs)[source]#

Test the YawningTitanDB.update function fails when updating a locked entry.

tests.unit_tests.db.test_yawning_titan_db.test_upsert_insert(demo_db_docs)[source]#

Test the YawningTitanDB.upsert function with a new insert.

tests.unit_tests.db.test_yawning_titan_db.test_upsert_update(demo_db_docs)[source]#

Test the YawningTitanDB.upsert function with an update.

tests.unit_tests.db.test_yawning_titan_db.test_remove(demo_db_docs)[source]#

Test the YawningTitanDB.remove function.

tests.unit_tests.db.test_yawning_titan_db.test_remove_with_uuid(demo_db_docs)[source]#

Test the YawningTitanDB.remove_with_uuid function.

tests.unit_tests.db.test_yawning_titan_db.test_remove_with_uuid_multiple_fails(demo_db_docs)[source]#

Test YawningTitanDB.remove_with_uuid function fails with duplicate uuid’s.

tests.unit_tests.db.test_yawning_titan_db.test_remove_locked_fails(demo_db_docs)[source]#

Test the YawningTitanDB.remove function fails when removing a locked entry.