fpiweb.tests package

Submodules

fpiweb.tests.AddPermissionData module

fpiweb.tests.AddPermissionData.iterate_permissions(permissions)[source]

Generator to pick up the needed foreign keys for a given permisison.

Parameters

permissions – attributes associated with this permission

Returns

fpiweb.tests.AddPermissionData.setup_group_permissions(group, permissions)[source]

For a given group, create or replace the permisisons for it.

Parameters
  • group – group to be created or replaced

  • permissions – list of permissions to be applied to this group

Returns

fpiweb.tests.AddPermissionData.setup_groups_and_permissions(*args, **kwargs)[source]

Create or replace groups and add permissions.

Parameters

groups_and_permissions – table of groups and associated permissions

Returns

fpiweb.tests.rework_func_ManualBoxManagement module

class fpiweb.tests.rework_func_ManualBoxManagement.ManualBoxManagement(methodName='runTest')[source]

Bases: django.contrib.staticfiles.testing.StaticLiveServerTestCase

HEADLESS_MODE = True
RECORD = False
delay_for_recording()[source]
fixtures = ['BoxType.json', 'LocBin.json', 'LocRow.json', 'LocTier.json', 'Location.json', 'ProductCategory.json', 'Product.json', 'Box.json', 'Pallet.json', 'PalletBox.json', 'Constraints.json']
classmethod get_browser_mode()[source]
select_random_dropdown(dropdown_int)[source]
setUp()[source]

Prepare for StaticLiveServerTestCase :return:

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

set_location_test()[source]
classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_1LogIn()[source]
test_2ManualBoxPalletManagementPage()[source]
test_3ManualStatusBox()[source]
test_4AddNewBox()[source]
test_5CheckinBox()[source]
test_6Checkout_a_box()[source]
test_7Move_a_box()[source]
test_user = ''

fpiweb.tests.rework_func_ManualPalletManagement module

class fpiweb.tests.rework_func_ManualPalletManagement.ManualPalletMaintenance(methodName='runTest')[source]

Bases: django.contrib.staticfiles.testing.StaticLiveServerTestCase

HEADLESS_MODE = True
RECORD = False
START_LOCATION = True
delay_for_recording()[source]
fixtures = ['BoxType.json', 'LocBin.json', 'LocRow.json', 'LocTier.json', 'Location.json', 'ProductCategory.json', 'Product.json', 'Box.json', 'Pallet.json', 'PalletBox.json', 'Constraints.json']
classmethod run_headless_mode()[source]
select_random_dropdown(dropdown_int)[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

set_pallet_location(row, bin, tier, start_location)[source]
classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_1A_Move_a_pallet()[source]
test_1B_MovePallet()[source]
test_1C_MovePallet()[source]
test_user = ''

fpiweb.tests.rework_func_UserManagement module

class fpiweb.tests.rework_func_UserManagement.UserManagementTest(methodName='runTest')[source]

Bases: django.contrib.staticfiles.testing.StaticLiveServerTestCase

HEADLESS_MODE = True
RECORD = True
delay_for_recording()[source]
fixtures = ['Activity.json', 'Constraints.json', 'Group.json', 'PalletBox.json', 'BoxType.json', 'Location.json', 'LocBin.json', 'LocRow.json', 'LocTier.json', 'ProductExample.json', 'Product.json', 'ProductCategory.json', 'Box.json', 'Pallet.json']
classmethod get_browser_mode()[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_UserManagement()[source]

fpiweb.tests.test_forms module

class fpiweb.tests.test_forms.BoxItemFormTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

Test adding boxes to the pallet form.

fixtures = ('BoxType', 'Product', 'ProductCategory', 'Constraints')
test_box_number_validation()[source]
test_expire_months()[source]

Ensure that start month <= end month

class fpiweb.tests.test_forms.BuildPalletFormTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

Test the form for building a pallet of boxes.

test_is_valid__location_not_specified()[source]
class fpiweb.tests.test_forms.ConfirmMergeFormTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

fixtures = ('Location', 'LocBin', 'LocRow', 'LocTier')
test_boxes_at_location_int()[source]
test_is_valid()[source]
test_to_location_str()[source]
class fpiweb.tests.test_forms.ExistingLocationFormTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

fixtures = ('LocRow', 'LocBin', 'LocTier', 'Location')
test_clean__multiple_locations_found()[source]
test_clean__nonexistent_location()[source]
test_clean__successful_run()[source]
class fpiweb.tests.test_forms.ExistingLocationWithBoxesFormTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

fixtures = ('BoxType', 'LocRow', 'LocBin', 'LocTier', 'Location')
test_clean()[source]
class fpiweb.tests.test_forms.LocationFormTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

fixtures = ('LocRow', 'LocBin', 'LocTier')
test_is_valid__missing_value()[source]
class fpiweb.tests.test_forms.MoveToLocationFormTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

fixtures = ('Location', 'LocBin', 'LocRow', 'LocTier')
test_is_valid()[source]

MoveToLocationForm adds the from_location field to the ExistingLocationForm so we only look at how from_location effects validation. :return: None

class fpiweb.tests.test_forms.NewBoxFormTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

Test creating a new box number not previously in inventory.

fixtures = ('BoxType', 'Constraints')
test_save()[source]

Test saving a new box number.

Returns

fpiweb.tests.test_models module

class fpiweb.tests.test_models.BoxTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

fixtures = ('ProductCategory', 'BoxType', 'Product')
static test_add() → None[source]

fpiweb.tests.test_password_validation module

class fpiweb.tests.test_password_validation.PasswordValidationTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_password_validation()[source]
static validate(password, user=None)[source]

fpiweb.tests.test_setup module

test_setup.py - Activities required before testing can begin.

fpiweb.tests.test_setup.add_permission_data()[source]

Define a fixtureto add the permission data.

Returns

fpiweb.tests.test_setup.setup_module()[source]

Setup activities required before a test can begin.

Returns

fpiweb.tests.test_support_box_and_activity module

test_support_box_and_activity.py - Test handling activity records.

class fpiweb.tests.test_support_box_and_activity.BoxSupportTestCase(methodName='runTest')[source]

Bases: django.test.testcases.TransactionTestCase

test_support_activityClass - Test handling activity records.

fixtures = ['Box', 'BoxType', 'Product', 'ProductCategory', 'LocRow', 'LocBin', 'LocTier', 'Location', 'Activity', 'Constraints']
classmethod setUpClass() → None[source]

Prepare to test box creation and manipulation.

Returns

classmethod tearDownClass() → None[source]

Testing done, discard testing data. :return:

test_box_consume() → None[source]

Test consuming a box under various circumstances.

Returns

test_box_fill() → None[source]

Test adding a box under various circumstances.

Returns

test_box_move() → None[source]

Test moving a box under various circumstances.

Returns

test_box_new() → None[source]

Test adding a new box number to the inventory.

Returns

test_pallet_finish() → None[source]

Test loading and finishing off a pallet.

Build a new pallet, add some boxes to it, stash the pallet id, the pallet box ids, and the box ids associated with them. Then finish the pallet and make sure the pallet and all its pallet boxes have been deleted, while the boxes themselves have been preserved. Since we are going through the new and fill logic above, we are going to assume the activity records have been properly created.

Returns

class fpiweb.tests.test_support_box_and_activity.PalletBoxInfo(pallet_box_id: int, box_id: int, box_number: str, product: str, exp_year: int)[source]

Bases: tuple

Holds an entry in the dictionary of pallet box info.

box_id: int

Alias for field number 1

box_number: str

Alias for field number 2

exp_year: int

Alias for field number 4

pallet_box_id: int

Alias for field number 0

product: str

Alias for field number 3

fpiweb.tests.test_views module

class fpiweb.tests.test_views.AboutViewTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_get()[source]
class fpiweb.tests.test_views.BoxNewViewTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

fixtures = ('Constraints', 'BoxType')
test_get_success_url()[source]
class fpiweb.tests.test_views.BuildPalletViewTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

static build_boxes(number_of_boxes)[source]
static build_pallet_boxes(pallet, boxes, product, exp_year)[source]
fixtures = ('Location', 'LocRow', 'LocBin', 'LocTier', 'Product', 'ProductCategory', 'BoxType', 'Constraints')
static get_box_forms_post_data(pallet_boxes)[source]
static get_box_item_form_data(box_number, product, exp_year=None)[source]
static get_build_pallet_form(location)[source]
static get_build_pallet_form_post_data(location)[source]
static get_hidden_pallet_form_post_data(pallet)[source]
static get_pallet_form(pallet)[source]
static setup_user_and_client(first_name: str, last_name: str) → django.test.client.Client[source]
test_get()[source]
test_post_bad_form_name()[source]
test_post_pallet_name_form()[source]
test_post_pallet_select_name_form()[source]
test_post_process_box_forms()[source]
test_prepare_pallet_and_pallet_boxes__duplicate_box_numbers()[source]
test_prepare_pallet_and_pallet_boxes__successful_run()[source]
url = '/fpiweb/build_pallet/'
class fpiweb.tests.test_views.IndexViewTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_get_success_url()[source]
class fpiweb.tests.test_views.LoginViewTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_get()[source]
test_login_required_redirects_to_login_view()[source]
test_post()[source]
class fpiweb.tests.test_views.LogoutViewTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_get()[source]
class fpiweb.tests.test_views.ManualMoveBoxViewTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

fixtures = ('BoxType', 'ProductCategory', 'Product', 'LocRow', 'LocBin', 'LocTier', 'Location')
static setup_user_and_client(first_name: str, last_name: str) → django.test.client.Client[source]
test_get()[source]
test_post_box_number_form()[source]
test_post_location_form()[source]
url = '/fpiweb/manual_move_box/'
class fpiweb.tests.test_views.ManualPalletMoveViewTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

static build_confirm_merge_post_data(from_location, to_location, action)[source]
static build_to_location_form_post_data(from_location, to_location)[source]
fixtures = ('BoxType', 'Constraints', 'Location', 'LocBin', 'LocRow', 'LocTier', 'Product', 'ProductCategory')
static setup_user_and_client(first_name, last_name)[source]
test_get()[source]
test_get_pallet_and_box_count()[source]
test_post__missing_mode()[source]
test_post__unrecognized_mode()[source]
test_post_confirm_merge_form__action_change_location()[source]
test_post_confirm_merge_form__action_merge_pallets()[source]
test_post_confirm_merge_form__form_invalid()[source]
test_post_from_location_form__form_invalid()[source]
test_post_from_location_form__form_valid()[source]
test_post_to_location_form__boxes_in_to_location()[source]
test_post_to_location_form__form_invalid()[source]
test_post_to_location_form__move_complete()[source]
url = '/fpiweb/manual_pallet_move/'
class fpiweb.tests.test_views.TestBoxItemFormView(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_get_form()[source]
fpiweb.tests.test_views.add_prefix(post_data, prefix)[source]
fpiweb.tests.test_views.formset_form_post_data(prefix, form_index, form_data)[source]
fpiweb.tests.test_views.management_form_post_data(prefix, total_forms, initial_forms=0, min_num_forms=0, max_num_forms=100)[source]

fpiweb.tests.utility module

class fpiweb.tests.utility.ManageUserPermissions[source]

Bases: object

fpiweb.tests.utility.create_user(*, username: str, first_name: str = 'first', last_name: str = 'last', title: str = 'title', password: str = 'abc123', access: fpiweb.constants.AccessLevel = <AccessLevel.Volunteer: 10>)[source]
fpiweb.tests.utility.grant_required_permissions(user: django.contrib.auth.models.User, view: django.views.generic.base.View) → None[source]
fpiweb.tests.utility.logged_in_user(first_name: str, last_name: str, view=None) → django.test.client.Client[source]