Skip to content

Latest commit

 

History

History
167 lines (131 loc) · 3.84 KB

README-TESTING.md

File metadata and controls

167 lines (131 loc) · 3.84 KB

py-fortress QUICKSTART


Table of Contents

  • Document Overview
  • SECTION 1. Prerequisites
  • SECTION 2. Setup Test Env
  • SECTION 3. Integration Tests
  • SECTION 4. Simple Test Samples
  • SECTION 5. View the Test Data using Command Line Interpreter (CLI)

Document Overview

Instructions to test py-fortress from source.


SECTION 1. Prerequisites

Minimum hardware requirements:

  • 1 Core
  • 1 GB RAM

Minimum software requirements:


SECTION 2. Setup Test Env

  1. Clone py-fortress
git clone https://github.com/shawnmckinney/py-fortress.git
  1. Change directory into root folder of project:
cd py-fortress
  1. Prepare the config:

From the project root folder, copy sample cfg file:

cp py-fortress-cfg.json.sample $PATH/py-fortress-cfg.json

Where PATH equals one of the following: a. current directory b. user home directory c. /etc/pyfortress d. pointed to by: export PYFORTRESS_CONF=...

sample cfg file is here: py-fortress-cfg.json.sample

  1. Now edit config file:
vi $PATH/py-fortress-cfg.json
  1. Set the LDAP URI
...
"ldap": {
...
"uri": "ldap://localhost:389",
...

use value obtained during LDAP setup

  1. Update the connection parameters (pick one):

    a. apacheds:

    "dn": "uid=admin,ou=system",
    

    b. openldap:

    "dn": "dc=example,dc=com",
    
  2. Set the structure in DIT:

    ...
    "dit": {
        "suffix": "dc=example,dc=com",
        "users": "People",
        "roles": "Roles",
        "perms": "Perms"
    },
    ...    
    

    if in doubt use the defaults

  3. Save and exit

  4. Prepare your terminal for execution of python3. From the main dir of the git repo:

python3 -m venv env
. env/bin/activate
export PYTHONPATH=$(pwd)
pip install "python-ldap>=3.4.2"
pip install "six>=1.16.0"
pip install "ldappool>=3.0.0"
  1. Run the bootstrap pgm that creates the LDAP node structure, i.e. the DIT
python3 rbac/tests/test_dit_dao.py
  • Locations for these nodes are set in the config file.*

SECTION 3. Integration Tests

These steps are optional and verify the env is working correctly.

  1. Run the admin mgr tests:
python3 rbac/tests/test_admin.py 
  1. Run the access mgr tests:
python3 rbac/tests/test_access.py 
  1. Run the review mgr tests:
python3 rbac/tests/test_review.py 

SECTION 4. Simple Test Samples

Another optional test.

  1. Run the samples:
python3 rbac/tests/test_samples.py 
  1. View the test_samples and learn how RBAC APIs work.

SECTION 5. View the Test Data using Command Line Interpreter (CLI)

View the test data inserted earlier.

  1. user search
$ python3 rbac/cli/cli.py user search --uid p
  1. role search
$ python3 rbac/cli/cli.py role search --name p
  1. perm search
$ python3 rbac/cli/cli.py perm search --obj_name p
  1. More CLI commands

End of README-TESTING