- 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)
Instructions to test py-fortress from source.
Minimum hardware requirements:
- 1 Core
- 1 GB RAM
Minimum software requirements:
- python-ldap dependencies installed README-UPGRADE-PYTHON
- LDAP server configured for Apache Fortress using README-LDAP-DOCKER
- Clone py-fortress
git clone https://github.com/shawnmckinney/py-fortress.git
- Change directory into root folder of project:
cd py-fortress
- 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
- Now edit config file:
vi $PATH/py-fortress-cfg.json
- Set the LDAP URI
...
"ldap": {
...
"uri": "ldap://localhost:389",
...
use value obtained during LDAP setup
-
Update the connection parameters (pick one):
a. apacheds:
"dn": "uid=admin,ou=system",
b. openldap:
"dn": "dc=example,dc=com",
-
Set the structure in DIT:
... "dit": { "suffix": "dc=example,dc=com", "users": "People", "roles": "Roles", "perms": "Perms" }, ...
if in doubt use the defaults
-
Save and exit
-
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"
- 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.*
These steps are optional and verify the env is working correctly.
- Run the admin mgr tests:
python3 rbac/tests/test_admin.py
- Run the access mgr tests:
python3 rbac/tests/test_access.py
- Run the review mgr tests:
python3 rbac/tests/test_review.py
Another optional test.
- Run the samples:
python3 rbac/tests/test_samples.py
- View the test_samples and learn how RBAC APIs work.
View the test data inserted earlier.
- user search
$ python3 rbac/cli/cli.py user search --uid p
- role search
$ python3 rbac/cli/cli.py role search --name p
- perm search
$ python3 rbac/cli/cli.py perm search --obj_name p
- More CLI commands
- README-CLI and README-CLI-AUTH for more operations to test.