tests Package

tests Package

restfulchemy.tests.__init__

Tests for RESTfulchemy create, get, and update methods.

copyright:(c) 2015 by Nicholas Repole and contributors. See AUTHORS for more details.
license:MIT - See LICENSE for more details.
class restfulchemy.tests.AlbumPlus(**kwargs)[source]

Bases: mqlalchemy.tests.models.Album

Extension class of Album for test purposes.

album_id
artist
artist_id
test = <object object>
title
class restfulchemy.tests.RESTfulchemyTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

A collection of RESTfulchemy tests.

setUp()[source]

Configure a db session for the chinook database.

test_bad_page_num()[source]

Not providing a max page size with page > 1 should fail.

test_db()[source]

Make sure our test db is functional.

test_get_all_objects()[source]

Test getting all objects with an empty dict of params.

test_get_all_objects_null_query()[source]

Test getting all objects with query_params set to None.

test_get_class_attributes_invalid_attr_fail()[source]

Ensure get_class_attributes fails - no such attr in model.

test_get_class_attributes_invalid_start_fail()[source]

Ensure get_class_attributes fails - no leading class name.

test_get_first_page()[source]

Test that we can get the first page of a set of objects.

test_get_resource()[source]

Test simple get_resource functionality.

test_get_resource_bad_query()[source]

Ensure get_resource fails when passed bad query parameters.

test_get_resource_list_param()[source]

Test get_resource functionality with list query params.

test_get_resources()[source]

Test simple get_resources functionality.

test_get_resources_filters()[source]

Test simple get_resources filtering functionality.

test_get_resources_ordered()[source]

Test simple get_resources ~order_by functionality.

test_get_second_page()[source]

Test that we can get the second page of a set of objects.

test_invalid_new_parent()[source]

Make sure that $new errors when parent isn’t relationship.

test_invalid_new_parent_column()[source]

Make sure that $new errors when parent is a column prop.

test_invalid_remove()[source]

Make sure that a %remove on a non relation item errors.

test_invalid_set_obj_to_raw_value()[source]

Make sure we can’t set a relationship to a raw value.

test_invalid_set_relation_parent()[source]

Make sure that $id errors when parent isn’t relationship.

test_invalid_set_relation_parent_column()[source]

Make sure that $id errors when parent is a column prop.

test_limit()[source]

Make sure providing a limit query_param works.

test_limit_fail()[source]

Make sure providing a bad limit query_param is ignored.

test_limit_override()[source]

Ensure providing a page_max_size overrides a high limit.

test_list_relation_add_item()[source]

Make sure that we can add an item to a list relation.

test_list_relation_add_item_generic_whitelist()[source]

Ensure generic whitelisting works for updating a relation.

test_list_relation_add_item_no_add_fail()[source]

Make sure that we can add an item to a list relation.

test_list_relation_add_item_whitelist()[source]

Make sure we can add an item to a whitelisted relation.

test_list_relation_add_item_whitelist_fail()[source]

Ensure whitelisting rightly fails for updating a relation.

test_list_relation_new()[source]

Make sure that we can add to a list using relationship.

test_list_relation_new_generic_whitelist()[source]

Make sure generic whitelisting works for list relations.

test_list_relation_new_whitelist()[source]

Make sure whitelisting is working for list relations.

test_list_relation_new_whitelist_fail()[source]

Make sure whitelisting properly fails for list relations.

test_list_relation_remove_item()[source]

Make sure that we can remove an item from a list relation.

test_list_relation_remove_item_generic_whitelist()[source]

Ensure generic whitelisting works for deleting a relation.

test_list_relation_remove_item_whitelist()[source]

Make sure we can remove an item in a whitelisted relation.

test_list_relation_remove_item_whitelist_fail()[source]

Ensure whitelisting rightly fails for deleting a relation.

test_list_relation_update_item()[source]

Ensure we can update a list relationship item.

test_list_relation_update_item_whitelist()[source]

Ensure we can update a whitelisted list relationship item.

test_new_single_relation_item()[source]

Make sure that a non-list relation can be created.

test_new_single_relation_item_generic_whitelist()[source]

Ensure a generic whitelist works for a non-list relation.

test_new_single_relation_item_whitelist()[source]

Make sure a whitelisted non-list relation can be set.

test_new_single_relation_item_whitelist_fail()[source]

Ensure a non-whitelisted new non-list relation fails.

test_no_page_max_size_fail()[source]

Not providing a max page size with page > 1 should fail.

test_null_update()[source]

Make sure that a obj update works with no update params.

test_offset()[source]

Make sure providing an offset query_param works.

test_offset_fail()[source]

Make sure providing a bad offset query_param is ignored.

test_remove_single_relation_item()[source]

Make sure a non-list relation can be removed.

test_remove_single_relation_item_bad_id()[source]

Make sure a non matching $id can’t be removed.

test_remove_single_relation_item_generic_whitelist()[source]

Ensure generic whitelisted non-list relation is deletable.

test_remove_single_relation_item_whitelist()[source]

Make sure a whitelisted non-list relation can be removed.

test_remove_single_relation_item_whitelist_fail()[source]

Ensure invalid whitelist fails to remove single relation.

test_set_empty_single_relation_item()[source]

Make sure that an empty non-list relation can be set.

test_set_empty_single_relation_item_no_set_fail()[source]

Ensure no .$set causes failure on null non list relation.

test_set_empty_single_relation_item_whitelist_fail()[source]

Ensure setting empty non whitelisted relation item fails.

test_set_single_relation_item()[source]

Make sure that a non-list relation can be set.

test_set_single_relation_item_generic_whitelist()[source]

Ensure a generic whitelist works for a non-list relation.

test_set_single_relation_item_no_set_fail()[source]

Ensure no .$set causes a failure on non list relation.

test_set_single_relation_item_whitelist()[source]

Make sure a whitelisted non-list relation can be set.

test_set_single_relation_item_whitelist_fail()[source]

Ensure setting non whitelisted single relation items fail.

test_simple_create()[source]

Make sure we can create a new instance of a model.

test_simple_update()[source]

Make sure that a simple obj update works.

test_single_relation_item()[source]

Make sure that a non-list relation can have a field set.

test_single_relation_item_bad_id_fail()[source]

Ensure an invalid $id errors as expected.

test_single_relation_item_no_id_fail()[source]

Ensure we can’t set a non list relation field with no id.

test_single_relation_item_set_fail()[source]

Ensure we can’t set an id relation to a non object value.

test_stack_size_limit()[source]

Make sure that limiting the stack size works as expected.