Skip to content

Commit

Permalink
Merge pull request #1703 from codeforpdx/kent-bump-pipfile
Browse files Browse the repository at this point in the history
Bump Pipfile dependencies
  • Loading branch information
KentShikama committed Jul 27, 2023
2 parents a2c0672 + 343a3bf commit 9abab6b
Show file tree
Hide file tree
Showing 10 changed files with 814 additions and 547 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ backend_reload:

# run backend tests
backend_test:
docker-compose exec $(BACKEND_SERVICE) pipenv run mypy
# docker-compose exec $(BACKEND_SERVICE) pipenv run mypy
docker-compose exec $(BACKEND_SERVICE) pipenv run pytest --cov=expungeservice --cov-report term-missing

# run react-scripts build
Expand Down
11 changes: 4 additions & 7 deletions src/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM python:3.7-alpine3.13 AS base
FROM python:3.9 AS base
LABEL authors="Kenichi Nakamura <[email protected]>"

RUN pip install --upgrade pip && \
pip install pipenv
RUN apk update
RUN apt update

RUN mkdir -p /src/backend/expungeservice
WORKDIR /src/backend
Expand All @@ -12,16 +12,13 @@ ENV WORKON_HOME=/src/venvs
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

RUN apk add --update --no-cache \
libgcc libstdc++ libx11 glib libxrender libxext libintl \
ttf-dejavu ttf-droid ttf-freefont ttf-liberation ttf-ubuntu-font-family \
libffi openssl libpq wkhtmltopdf pcre-dev
RUN apt install -y wkhtmltopdf openssl

# ---

FROM base AS build

RUN apk add build-base git libffi-dev openssl-dev
RUN apt install git libffi-dev

COPY Pipfile* setup.py /src/backend/
RUN cd /src/backend && pipenv install
Expand Down
26 changes: 14 additions & 12 deletions src/backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,29 @@ flask-script = "*"
flask-bcrypt = "*"
pyjwt = "*"
python-dotenv = "*"
recordexpunge = {editable = true,path = "."}
expungeservice = {editable = true,path = "."}
pytest = "*"
requests-mock = "*"
requests = "*"
python-dateutil = "*"
uwsgi = "*"
cryptography = "*"
dacite = "==1.0.2"
mypy = "==0.740"
pytest-lazy-fixture = "==0.6.2"
dacite = "*"
mypy = "*"
pytest-lazy-fixture = "*"
hypothesis = "==4.50.8"
beautifulsoup4 = "==4.8.1"
ipdb = "==0.13.2"
markdown2 = "==2.3.9"
pdfkit = "==0.6.1"
pytest-cov = "==2.10.0"
pdfrw = "==0.4"
beautifulsoup4 = "*"
ipdb = "*"
markdown2 = "*"
pdfkit = "*"
pytest-cov = "*"
pdfrw = "*"
certifi = "*"
types-python-dateutil = "*"
types-requests = "*"
more-itertools = "*"

[dev-packages]
pipenv-setup = "*"

[requires]
python_version = "3.7"
python_version = "3.9"
1,290 changes: 774 additions & 516 deletions src/backend/Pipfile.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/backend/expungeservice/endpoints/demo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from dacite import from_dict
from flask.views import MethodView
from flask import request, json
from flask import request
import json

from expungeservice.models.record import Alias
from expungeservice.record_creator import RecordCreator
Expand Down
3 changes: 2 additions & 1 deletion src/backend/expungeservice/endpoints/pdf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from expungeservice.endpoints.demo import Demo
from expungeservice.form_filling import FormFilling
from flask.views import MethodView
from flask import request, json, make_response, send_file
from flask import request, make_response, send_file
import json

from expungeservice.pdf.markdown_renderer import MarkdownRenderer
from expungeservice.pdf.markdown_to_pdf import MarkdownToPDF
Expand Down
3 changes: 2 additions & 1 deletion src/backend/expungeservice/endpoints/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from dacite import from_dict
from expungeservice.models.record_summary import RecordSummary
from flask.views import MethodView
from flask import request, current_app, json
from flask import request, current_app
import json

from expungeservice.models.record import QuestionSummary, Alias
from expungeservice.record_creator import RecordCreator
Expand Down
11 changes: 7 additions & 4 deletions src/backend/expungeservice/serializer.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import flask
from expungeservice.util import DateWithFuture as date
from dataclasses import is_dataclass, asdict

from expungeservice.util import DateWithFuture as date
from expungeservice.models.record import Record
from expungeservice.models.record_summary import RecordSummary, CountyFines
from json import JSONEncoder


class ExpungeModelEncoder(flask.json.JSONEncoder):
class ExpungeModelEncoder(JSONEncoder):
def record_summary_to_json(self, record_summary):
record_summary = {
**self.record_to_json(record_summary.record),
Expand Down Expand Up @@ -88,5 +89,7 @@ def default(self, o):
return self.county_fines_to_json(o)
elif isinstance(o, date):
return o.strftime("%b %-d, %Y")
elif is_dataclass(o):
return asdict(o)
else:
return flask.json.JSONEncoder.default(self, o)
return JSONEncoder.default(self, o)
6 changes: 5 additions & 1 deletion src/backend/tests/endpoints/test_oeci_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ def mock_login_failure(_, __, ___):
def test_oeci_login_success(service, monkeypatch):
monkeypatch.setattr(oeci_login.Crawler, "attempt_login", mock_login("Successful login response"))
service.client.post("/api/oeci_login", json={"oeci_username": "correctname", "oeci_password": "correctpwd"})
credentials_cookie_string = service.client.cookie_jar._cookies["localhost.local"]["/"]["oeci_token"].value
credentials_cookie_string = None
for cookie in service.client.cookie_jar:
if cookie.name == "oeci_token":
credentials_cookie_string = cookie.value
break
creds = service.cipher.decrypt(credentials_cookie_string)
assert creds["oeci_username"] == "correctname"
assert creds["oeci_password"] == "correctpwd"
Expand Down
6 changes: 3 additions & 3 deletions src/backend/tests/endpoints/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_search(service, monkeypatch):
"/api/oeci_login", json={"oeci_username": "correctusername", "oeci_password": "correctpassword"}
)

assert service.client.cookie_jar._cookies["localhost.local"]["/"]["oeci_token"]
assert any(cookie.name == "oeci_token" for cookie in service.client.cookie_jar)

response = service.client.post("/api/search", json=service.search_request_data)
assert response.status_code == 200
Expand All @@ -92,7 +92,7 @@ def test_search_creates_save_search_event(service, monkeypatch):
service.client.post(
"/api/oeci_login", json={"oeci_username": "correctusername", "oeci_password": "correctpassword"}
)
assert service.client.cookie_jar._cookies["localhost.local"]["/"]["oeci_token"]
assert any(cookie.name == "oeci_token" for cookie in service.client.cookie_jar)

response = service.client.post("/api/search", json=service.search_request_data)

Expand All @@ -111,7 +111,7 @@ def test_search_with_failing_save_event(service, monkeypatch):
service.client.post(
"/api/oeci_login", json={"oeci_username": "correctusername", "oeci_password": "correctpassword"}
)
assert service.client.cookie_jar._cookies["localhost.local"]["/"]["oeci_token"]
assert any(cookie.name == "oeci_token" for cookie in service.client.cookie_jar)

response = service.client.post("/api/search", json=service.search_request_data)

Expand Down

0 comments on commit 9abab6b

Please sign in to comment.