diff --git a/controller_function/controller/auth.py b/controller_function/controller/auth.py index 75ca4e7..6cd291c 100644 --- a/controller_function/controller/auth.py +++ b/controller_function/controller/auth.py @@ -32,13 +32,11 @@ def __init__(self) -> None: def create_access_token(self): """Create an access token.""" - token_claims = {"sub": "controller-app"} access_token_expires = timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES) - expire = datetime.utcnow() + access_token_expires - token_claims.update({"exp": expire}) + token_claims = {"sub": "controller-app", "exp": expire} - return jwt.encode(token_claims, self.private_key, algorithm=ALGORITHM) + return jwt.encode(token_claims, self.private_key, algorithm=ALGORITHM) # type: ignore def __call__(self, r: requests.PreparedRequest) -> requests.PreparedRequest: """Attach Authorization Header to a request.""" diff --git a/controller_function/run_tests.sh b/controller_function/run_tests.sh index d494c89..219adc1 100755 --- a/controller_function/run_tests.sh +++ b/controller_function/run_tests.sh @@ -25,7 +25,7 @@ status=$((status+$?)) echo "Running pylint..." # shellcheck disable=SC2038 find . -type f -name "*.py" ! \( -path "./.venv/*" \) | - xargs pylint --init-hook='import sys; sys.setrecursionlimit(2000)' --rcfile=tests/pylintrc + xargs pylint --rcfile=tests/pylintrc status=$((status+$?)) # Run our unit tests with code coverage diff --git a/controller_function/tests/mypy.ini b/controller_function/tests/mypy.ini index 976ba02..193eac3 100644 --- a/controller_function/tests/mypy.ini +++ b/controller_function/tests/mypy.ini @@ -1,2 +1,7 @@ [mypy] ignore_missing_imports = True +check_untyped_defs = True +plugins = pydantic.mypy + +[pydantic-mypy] +init_forbid_extra = True