wiki:DeveloperGuidelines/Testing/Roles

Version 1 (modified by somayjain, 8 years ago) ( diff )

--

Roles Tests

Introduction

Role tests are used to check the permissions of user roles.

Running The Tests

Make sure that the database is prepopulated. If not, then run -

cd web2py/applications/eden
rm databases/*
cd ../..
python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py

To start the tests, run -

python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py -A --suite roles

Information About the Test Suite

Location

The tests are located in modules/tests/roles/

The template specific files are located in modules/tests/roles/<template_name>

Files

  • The file modules/tests/roles/test_roles.py tests permissions against role matrix file.
  • The data for the roles tests is created by modules/tests/roles/create_role_test_data.py
    • It depends on the following for creating the data -
      • org_organisation.xml - A generic file for all templates. It is used for importing the organisation.
      • org_organisation_branch.xml - A generic file for all templates. It is used for importing the organisation branches, if the template uses branches.
      • <template_name>/data.xml - A file template for the data which the user's roles will be tested against.
      • <template_name>/users_template.csv - A file template for the users and roles which will be tested.
      • <template_name>/test_users.csv - An optional file which is used to create users - handy for debugging.
  • The user permissions are defined in <template_name>/Org-A_permission_matrix.csv. The permissions declared in this file are tested upon.
Note: See TracWiki for help on using the wiki.