Skip to content

Commit 94de36d

Browse files
authored
build: Fix make test-all by implementing pii_check (#527)
Copied code from cookiecutter-django-app.
1 parent 6718284 commit 94de36d

File tree

4 files changed

+85
-0
lines changed

4 files changed

+85
-0
lines changed

.annotation_safe_list.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This is a Code Annotations automatically-generated Django model safelist file.
2+
# These models must be annotated as follows in order to be counted in the coverage report.
3+
# See https://code-annotations.readthedocs.io/en/latest/safelist.html for more information.
4+
#
5+
# fake_app_1.FakeModelName:
6+
# ".. no_pii:": "This model has no PII"
7+
# fake_app_2.FakeModel2:
8+
# ".. choice_annotation:": foo, bar, baz
9+
10+
admin.LogEntry:
11+
".. no_pii:": "This model has no PII"
12+
auth.Group:
13+
".. no_pii:": "This model has no PII"
14+
auth.Permission:
15+
".. no_pii:": "This model has no PII"
16+
auth.User:
17+
".. pii": "This model minimally contains a username, password, and email"
18+
".. pii_types": "username, email_address, password"
19+
".. pii_retirement": "consumer_api"
20+
contenttypes.ContentType:
21+
".. no_pii:": "This model has no PII"
22+
sessions.Session:
23+
".. no_pii:": "This model has no PII"
24+
social_django.Association:
25+
".. no_pii:": "This model has no PII"
26+
social_django.Code:
27+
".. pii:": "Email address"
28+
".. pii_types:": other
29+
".. pii_retirement:": local_api
30+
social_django.Nonce:
31+
".. no_pii:": "This model has no PII"
32+
social_django.Partial:
33+
".. no_pii:": "This model has no PII"
34+
social_django.UserSocialAuth:
35+
".. no_pii:": "This model has no PII"
36+
waffle.Flag:
37+
".. no_pii:": "This model has no PII"
38+
waffle.Sample:
39+
".. no_pii:": "This model has no PII"
40+
waffle.Switch:
41+
".. no_pii:": "This model has no PII"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ build/
77
**/private.py
88
.coverage
99
dist/
10+
/pii_report/*.yaml

.pii_annotations.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
source_path: ./
2+
report_path: pii_report
3+
safelist_path: .annotation_safe_list.yml
4+
coverage_target: 100.0
5+
annotations:
6+
".. no_pii:":
7+
"pii_group":
8+
- ".. pii:":
9+
- ".. pii_types:":
10+
choices:
11+
- id # Unique identifier for the user which is shared across systems
12+
- name # Used for any part of the user's name
13+
- username
14+
- password
15+
- location # Used for any part of any type address or country stored
16+
- phone_number # Used for phone or fax numbers
17+
- email_address
18+
- birth_date # Used for any part of a stored birth date
19+
- ip # IP address
20+
- external_service # Used for external service ids or links such as social media links or usernames, website links, etc.
21+
- biography # Any type of free-form biography field
22+
- gender
23+
- sex
24+
- image
25+
- video
26+
- other
27+
- ".. pii_retirement:":
28+
choices:
29+
- retained # Intentionally kept for legal reasons
30+
- local_api # An API exists in this repository for retiring this information
31+
- consumer_api # The data's consumer must implement an API for retiring this information
32+
- third_party # A third party API exists to retire this data
33+
extensions:
34+
python:
35+
- py

tox.ini

+8
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ commands =
7373
isort --check-only --diff edx_arch_experiments manage.py setup.py test_settings.py
7474
make selfcheck
7575

76+
[testenv:pii_check]
77+
setenv =
78+
DJANGO_SETTINGS_MODULE = test_settings
79+
deps =
80+
-r{toxinidir}/requirements/test.txt
81+
commands =
82+
code_annotations django_find_annotations --config_file .pii_annotations.yml --lint --report --coverage
83+
7684
[testenv:scripts]
7785
setenv =
7886
DJANGO_SETTINGS_MODULE = edx_arch_experiments.settings.scripts

0 commit comments

Comments
 (0)