Skip to content

Commit ffb5162

Browse files
committed
refactor: adding scripts to linter
1 parent 647b9c5 commit ffb5162

File tree

9 files changed

+329
-151
lines changed

9 files changed

+329
-151
lines changed

.github/workflows/unit-tests.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Unit Tests and Linting
2+
on: [push]
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
strategy:
7+
matrix:
8+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
9+
steps:
10+
- uses: actions/checkout@v3
11+
- name: Set up Python ${{ matrix.python-version }}
12+
uses: actions/setup-python@v4
13+
with:
14+
python-version: ${{ matrix.python-version }}
15+
- name: Install dependencies
16+
run: |
17+
python -m pip install --upgrade pip
18+
pip install pytest
19+
pip install -r requirements.txt
20+
- name: Lint code base
21+
run: |
22+
python -m pylama Access/accessrequest_helper.py scripts
23+
- name: Test with pytest
24+
run: |
25+
python -m pytest -v --cov --disable-warnings

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ test: setup_mounts ensure_web_container_for_test
7070
lint: export APPUID = $(APP_UID)
7171
lint: setup_mounts ensure_web_container_for_test
7272
@docker exec dev python -m pylama --version
73-
@docker exec dev python -m pylama Access/accessrequest_helper.py
73+
@docker exec dev python -m pylama Access/accessrequest_helper.py scripts
7474
@if [ "$$?" -ne 0 ]; then \
7575
echo "Linter checks failed"; \
7676
exit 1; \

config.json.sample

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
"access_modules": {
2727
"git_urls": [
2828
"https://github.com/browserstack/enigma-access-modules.git"
29-
],
30-
"RETRY_LIMIT": 5
29+
]
3130
},
3231
"enigmaGroup": {
3332
"MAIL_APPROVER_GROUPS": []

docs/Configuration Guide.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@
44
## Parameters:
55
The following table lists all the default Enigma configuration parameters and also explains the usage:
66

7-
Parameter name | Default | Description
8-
--- | --- | ---
9-
django_setup.SECRET_KEY | "" (Empty string) | `String` Set the DJANGO setup secret key. This value should be kept secret.
10-
django_setup.DEBUG | True (dev mode only) | `Boolean` User authorised to view details of all users. <br> **Note: DEBUG should be set to `False` in production.**
11-
django_setup.ALLOWED_HOSTS | [] (Empty list) | `Array` User authorised to view access of all users. <br> If DEBUG is False, you also need to properly set the ALLOWED_HOSTS setting. Failing to do so will result in all requests being returned as “Bad Request (400)”
12-
sso.googleapi.SOCIAL_AUTH_GOOGLE_OAUTH2_KEY | "" (Empty string) | `String` Google OAuth 2.0 client ID. Obtain OAuth 2.0 credentials from the Google API Console.
13-
sso.googleapi.SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET | "" (Empty string) | `String` Google OAuth 2.0 client secret. Obtain OAuth 2.0 credentials from the Google API Console.
14-
database.engine | sqlite3 | `String` The database backend to use. Enigma has support for **mysql** and **sqlite3**
15-
database.dbname | "" (Empty string) | `String` The name of the database to use. *Not used with SQLite.*
16-
database.username | "" (Empty string) | `String` The username to use when connecting to the database. *Not used with SQLite.*
17-
database.password | "" (Empty string) | `String` The password to use when connecting to the database. *Not used with SQLite.*
18-
database.host | "" (Empty string) | `String` The host to use when connecting to the database. *Not used with SQLite.*
19-
database.port | | `Integer` The port to use when connecting to the database. *Not used with SQLite.*
20-
access_modules.git_urls | ["https://github.com/browserstack/enigma-access-modules.git"] (Enigma's Access Module Repository)| `Array` List of Git URLs of access modules, these URLs are fed to the cloning script to pull the modules into the running container.
21-
access_modules.RETRY_LIMIT | 5 | `Integer` Maximum number of tries to clone the access modules repository
22-
enigmaGroup.MAIL_APPROVER_GROUPS | [] (Empty list) | `Array` List of approvers Email for managing groups.
23-
email.access-approve | "" (Empty string) | `String` Admin access approver's email address
24-
email.EMAIL_HOST | "" (Empty string) | `String` The host to use for sending email.
25-
email.EMAIL_PORT | "" (Empty string) | `String` Port to use for the SMTP server
26-
email.EMAIL_HOST_USER | "" (Empty string) | `String` Username to use for the SMTP server
27-
email.EMAIL_HOST_PASSWORD | "" (Empty string) | `String` Password to use for the SMTP server
28-
email.EMAIL_USE_TLS | True | `Boolean` Whether to use a TLS (secure) connection when talking to the SMTP server.
29-
email.EMAIL_USE_SSL | False | `Boolean` Whether to use an implicit TLS (secure) connection when talking to the SMTP server.
30-
email.DEFAULT_FROM_EMAIL | "" (Empty string) | `String` Default email address to use for various correspondence from Enigma.
31-
background_task_manager.type | celery | `String` Type can be **celery** or **threading**
32-
background_task_manager.config | | *Not used with threading.* <br> Refer to [Celery.md](docs/Celery.md) for detailed information on celery configuration parameters/
7+
| Parameter name | Default | Description |
8+
|------------------------------------------------|---------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
9+
| django_setup.SECRET_KEY | "" (Empty string) | `String` Set the DJANGO setup secret key. This value should be kept secret. |
10+
| django_setup.DEBUG | True (dev mode only) | `Boolean` User authorised to view details of all users. <br> **Note: DEBUG should be set to `False` in production.** |
11+
| django_setup.ALLOWED_HOSTS | [] (Empty list) | `Array` User authorised to view access of all users. <br> If DEBUG is False, you also need to properly set the ALLOWED_HOSTS setting. Failing to do so will result in all requests being returned as “Bad Request (400)” |
12+
| sso.googleapi.SOCIAL_AUTH_GOOGLE_OAUTH2_KEY | "" (Empty string) | `String` Google OAuth 2.0 client ID. Obtain OAuth 2.0 credentials from the Google API Console. |
13+
| sso.googleapi.SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET | "" (Empty string) | `String` Google OAuth 2.0 client secret. Obtain OAuth 2.0 credentials from the Google API Console. |
14+
| database.engine | sqlite3 | `String` The database backend to use. Enigma has support for **mysql** and **sqlite3** |
15+
| database.dbname | "" (Empty string) | `String` The name of the database to use. *Not used with SQLite.* |
16+
| database.username | "" (Empty string) | `String` The username to use when connecting to the database. *Not used with SQLite.* |
17+
| database.password | "" (Empty string) | `String` The password to use when connecting to the database. *Not used with SQLite.* |
18+
| database.host | "" (Empty string) | `String` The host to use when connecting to the database. *Not used with SQLite.* |
19+
| database.port | | `Integer` The port to use when connecting to the database. *Not used with SQLite.* |
20+
| access_modules.git_urls | ["https://github.com/browserstack/enigma-access-modules.git"] | `Array` List of Git URLs of access modules, these URLs are fed to the cloning script to pull the modules into the running container. |
21+
| access_modules.RETRY_LIMIT | 5 | `Integer` Maximum number of tries to clone the access modules repository. |
22+
| enigmaGroup.MAIL_APPROVER_GROUPS | [] (Empty list) | `Array` List of approvers Email for managing groups. |
23+
| email.access-approve | "" (Empty string) | `String` Admin access approver's email address |
24+
| email.EMAIL_HOST | "" (Empty string) | `String` The host to use for sending email. |
25+
| email.EMAIL_PORT | "" (Empty string) | `String` Port to use for the SMTP server |
26+
| email.EMAIL_HOST_USER | "" (Empty string) | `String` Username to use for the SMTP server |
27+
| email.EMAIL_HOST_PASSWORD | "" (Empty string) | `String` Password to use for the SMTP server |
28+
| email.EMAIL_USE_TLS | True | `Boolean` Whether to use a TLS (secure) connection when talking to the SMTP server. |
29+
| email.EMAIL_USE_SSL | False | `Boolean` Whether to use an implicit TLS (secure) connection when talking to the SMTP server. |
30+
| email.DEFAULT_FROM_EMAIL | "" (Empty string) | `String` Default email address to use for various correspondence from Enigma. |
31+
| background_task_manager.type | celery | `String` Type can be **celery** or **threading** |
32+
| background_task_manager.config | | *Not used with threading.* <br> Refer to [Celery.md](docs/Celery.md) for detailed information on celery configuration parameters/ |
3333

3434

3535
The config file contains only the default parameters (described above). You can edit the file and add the configuration parameters depending on your requirement.

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,5 @@ django-cid==2.3
122122
flake8==6.0.0
123123
django-session-timeout==0.1.0
124124
django-axes==5.41.1
125+
jsonschema==4.17.3
126+
types-jsonschema==4.17.0

scripts/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)