-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workflows/backend/linting isnt applied recursively (#25)
* Fixes #24 * linting: added docs and removed trailing whitespaces * fixed: linting * added lint configuration file * added special linting rules where necessary
- Loading branch information
1 parent
bebf79a
commit 4991b3f
Showing
14 changed files
with
71 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
"""Index api point""" | ||
""" | ||
This is the index endpoint file. It contains the index endpoint of the API as specified by OpenAPI. | ||
""" | ||
|
||
from flask import Blueprint | ||
from flask_restful import Resource | ||
|
||
index_bp = Blueprint("index", __name__) | ||
|
||
|
||
class Index(Resource): | ||
"""Api endpoint for the / route""" | ||
""" | ||
Subclass of restfull Resource, used to define the index endpoint of the API. | ||
""" | ||
|
||
def get(self): | ||
"""Example of an api endpoint function that will respond to get requests made to / | ||
return a json data structure with key Message and value Hello World!""" | ||
return {"Message": "Hello World!"} | ||
""" | ||
Implementation of the GET method for the index endpoint. Returns the OpenAPI object. | ||
""" | ||
|
||
return {"Message": "Hello World!"} | ||
|
||
index_bp.add_url_rule("/", view_func=Index.as_view("index")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[MASTER] | ||
init-hook='import sys; sys.path.append(".")' | ||
|
||
[test-files:*_test.py] | ||
disable= | ||
W0621, # Redefining name %r from outer scope (line %s) | ||
|
||
[modules:project/modules/*] | ||
disable= | ||
R0903 # Too few public methods (modules don't require us to have public methods) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
""" | ||
This file contains the tests for the Users model. | ||
""" | ||
from project.models.users import Users | ||
|
||
|
||
class TestUserModel: | ||
"""Test class for the database models""" | ||
|
||
def test_valid_user(self, db_session, valid_user): | ||
"""Tests if a valid user can be added to the database.""" | ||
db_session.add(valid_user) | ||
db_session.commit() | ||
assert valid_user in db_session.query(Users).all() | ||
|
||
def test_is_teacher(self, db_session, teachers): | ||
"""Tests if the is_teacher field is correctly set to True | ||
for the teachers when added to the database.""" | ||
db_session.add_all(teachers) | ||
db_session.commit() | ||
teacher_count = 0 | ||
for usr in db_session.query(Users).filter_by(is_teacher=True): | ||
teacher_count += 1 | ||
assert usr.is_teacher | ||
assert teacher_count == 10 | ||
assert teacher_count == 10 |