Skip to content

Commit

Permalink
feat: add exam models (#10)
Browse files Browse the repository at this point in the history
* feat: add exam models

* chore: fix pylint errors

* fix: remove regex for path strings
  • Loading branch information
alangsto authored Jun 9, 2022
1 parent 91cd6fc commit 7113178
Show file tree
Hide file tree
Showing 37 changed files with 701 additions and 102 deletions.
45 changes: 45 additions & 0 deletions .annotation_safe_list.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This is a Code Annotations automatically-generated Django model safelist file.
# These models must be annotated as follows in order to be counted in the coverage report.
# See https://code-annotations.readthedocs.io/en/latest/safelist.html for more information.
#
# fake_app_1.FakeModelName:
# ".. no_pii:": "This model has no PII"
# fake_app_2.FakeModel2:
# ".. choice_annotation:": foo, bar, baz

admin.LogEntry:
".. no_pii:": "This model has no PII"
auth.Group:
".. no_pii:": "This model has no PII"
auth.Permission:
".. no_pii:": "This model has no PII"
contenttypes.ContentType:
".. no_pii:": "This model has no PII"
django_celery_results.ChordCounter:
".. no_pii:": "This model has no PII"
django_celery_results.GroupResult:
".. no_pii:": "This model has no PII"
django_celery_results.TaskResult:
".. no_pii:": "This model has no PII"
sessions.Session:
".. no_pii:": "This model has no PII"
social_django.Association:
".. no_pii:": "This model has no PII"
social_django.Code:
".. pii:": "Email address"
".. pii_types:": other
".. pii_retirement:": local_api
social_django.Nonce:
".. no_pii:": "This model has no PII"
social_django.Partial:
".. no_pii:": "This model has no PII"
social_django.UserSocialAuth:
".. no_pii:": "This model has no PII"
waffle.Flag:
".. no_pii:": "This model has no PII"
waffle.Sample:
".. no_pii:": "This model has no PII"
waffle.Switch:
".. no_pii:": "This model has no PII"
lti_consumer.LtiDlContentItem:
".. no_pii:": "This model has no PII"
4 changes: 4 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"directory": "edx-exams/static/bower_components",
"interactive": false
}
12 changes: 12 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[run]
branch = True
data_file = .coverage
source=edx_exams
omit =
edx_exams/settings*
edx_exams/conf*
*wsgi.py
*migrations*
*admin.py
*static*
*templates*
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Python CI

on:
push:
branches: [main]
pull_request:
branches:
- '**'


jobs:
run_tests:
name: tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
python-version: ['3.8']
toxenv: [django32, django40, quality, pii_check]

steps:
- uses: actions/checkout@v2
- name: setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install pip
run: pip install -r requirements/pip.txt

- name: Install Dependencies
run: pip install -r requirements/ci.txt

- name: Run Tests
env:
TOXENV: ${{ matrix.toxenv }}
run: tox

- name: Run coverage
if: matrix.python-version == '3.8' && matrix.toxenv == 'django32'
uses: codecov/codecov-action@v1
with:
flags: unittests
fail_ci_if_error: true
10 changes: 10 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Run commitlint on the commit messages in a pull request.

name: Lint Commit Messages

on:
- pull_request

jobs:
commitlint:
uses: edx/.github/.github/workflows/commitlint.yml@master
22 changes: 22 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Push Docker Images

on:
push:
branches:
- main
jobs:
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build and Push docker image
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
run : make github_docker_push
27 changes: 27 additions & 0 deletions .github/workflows/upgrade-python-requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Upgrade Python Requirements

on:
schedule:
- cron: "15 15 10/14 * *"
workflow_dispatch:
inputs:
branch:
description: "Target branch against which to create requirements PR"
required: true
default: 'master'

jobs:
call-upgrade-python-requirements-workflow:
uses: edx/.github/.github/workflows/upgrade-python-requirements.yml@master
with:
branch: ${{ github.event.inputs.branch || 'master' }}
# optional parameters below; fill in if you'd like github or email notifications
# user_reviewers: ""
# team_reviewers: ""
email_address: "[email protected]"
send_success_notification: true
secrets:
requirements_bot_github_token: ${{ secrets.REQUIREMENTS_BOT_GITHUB_TOKEN }}
requirements_bot_github_email: ${{ secrets.REQUIREMENTS_BOT_GITHUB_EMAIL }}
edx_smtp_username: ${{ secrets.EDX_SMTP_USERNAME }}
edx_smtp_password: ${{ secrets.EDX_SMTP_PASSWORD }}
92 changes: 89 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,89 @@
### Python artifacts
*.pyc
*.__pycache__
*.py[cod]

*.log

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
__pycache__

# Installer logs
pip-log.txt

# Django
default.db

# Static assets
media/cache/
assets/

# Unit test / coverage reports
.coverage
htmlcov
.tox
nosetests.xml
unittests.xml

# PII annotation reports
pii_report

### Internationalization artifacts
*.mo
*.po
*.prob
!django.po
!django.mo
!djangojs.po
!djangojs.mo
{{cookiecutter.project_name}}/conf/locale/fake*/LC_MESSAGES/*.po
{{cookiecutter.project_name}}/conf/locale/fake*/LC_MESSAGES/*.mo
{{cookiecutter.project_name}}/conf/locale/messages.mo


# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# QA
coverage.xml
diff_*.html
*.report
report
venv
acceptance_tests.*.log
acceptance_tests.*.png

# Override config files
override.cfg
private.py

# JetBrains
.idea

# Emacs
*~

# OS X
.DS_Store

# Editor Temp Files
*.swp

*.trace

docs/_build/
35 changes: 35 additions & 0 deletions .pii_annotations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
source_path: ./
report_path: pii_report
safelist_path: .annotation_safe_list.yml
coverage_target: 100.0
annotations:
".. no_pii:":
"pii_group":
- ".. pii:":
- ".. pii_types:":
choices:
- id # Unique identifier for the user which is shared across systems
- name # Used for any part of the user’s name
- username
- password
- location # Used for any part of any type address or country stored
- phone_number # Used for phone or fax numbers
- email_address
- birth_date # Used for any part of a stored birth date
- ip # IP address
- external_service # Used for external service ids or links such as social media links or usernames, website links, etc.
- biography # Any type of free-form biography field
- gender
- sex
- image
- video
- other
- ".. pii_retirement:":
choices:
- retained # Intentionally kept for legal reasons
- local_api # An API exists in this repository for retiring this information
- consumer_api # The data's consumer must implement an API for retiring this information
- third_party # A third party API exists to retire this data
extensions:
python:
- py
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ clean_pycrypto: ## temporary (?) hack to deal with the pycrypto dep that's insta

requirements: clean_pycrypto piptools dev_requirements ## sync to default requirements

test_requirements:
pip-sync -q requirements/test.txt

ci_requirements: validation_requirements ## sync to requirements needed for CI checks

dev_requirements: ## sync to requirements for local development
Expand Down Expand Up @@ -105,6 +108,7 @@ upgrade: piptools ## update the requirements/*.txt files with the latest package
pip install -qr requirements/pip-tools.txt
pip-compile --upgrade -o requirements/base.txt requirements/base.in
pip-compile --upgrade -o requirements/test.txt requirements/test.in
pip-compile --upgrade -o requirements/ci.txt requirements/ci.in
pip-compile --upgrade -o requirements/doc.txt requirements/doc.in
pip-compile --upgrade -o requirements/quality.txt requirements/quality.in
pip-compile --upgrade -o requirements/validation.txt requirements/validation.in
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def get_version(*file_paths):
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Expand Down
4 changes: 2 additions & 2 deletions edx_exams/apps/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
All API URLs should be versioned, so urlpatterns should only
contain namespaces for the active versions of the API.
"""
from django.conf.urls import include, url
from django.urls import include, path

from edx_exams.apps.api.v1 import urls as v1_urls

app_name = 'api'
urlpatterns = [
url(r'^v1/', include(v1_urls)),
path(r'^v1/', include(v1_urls)),
]
2 changes: 1 addition & 1 deletion edx_exams/apps/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from edx_exams.apps.core.models import User

Expand Down
Loading

0 comments on commit 7113178

Please sign in to comment.