Skip to content

Commit

Permalink
Merge pull request #809 from fecgov/release/sprint-40
Browse files Browse the repository at this point in the history
Release/sprint 40
  • Loading branch information
toddlees authored Apr 16, 2024
2 parents becd426 + c40975d commit 8aab0a2
Show file tree
Hide file tree
Showing 37 changed files with 926 additions and 1,162 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
- run:
name: Run tests
# Use built-in Django test module
command: coverage run --source='.' --rcfile=.coveragerc manage.py test --keepdb
command: coverage run --source='.' --rcfile=.coveragerc manage.py test
working_directory: ~/project/django-backend/

- run:
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
command: |
flake8 --config django-backend/.flake8
deploy:
deploy-job:
docker:
- image: cimg/python:3.10

Expand All @@ -174,7 +174,7 @@ jobs:
export PATH=$HOME/bin:$PATH
curl -L "https://cli.run.pivotal.io/stable?release=linux64-binary&version=7.1.0" | tar xzv -C $HOME/bin
- deploy:
- run:
name: Deploy API
command: |
export PATH=$HOME/bin:$PATH
Expand Down Expand Up @@ -244,7 +244,7 @@ workflows:
jobs:
- test
- dependency-check
- deploy:
- deploy-job:
requires:
- test
- dependency-check
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ django-backend/.local/
*.bower-registry
*.bower-tmp

# Locust Testing Data
locust-testing/locust-data/*.locust.json


# System Files
Expand All @@ -74,4 +76,4 @@ front-end/.vscode/launch.json
.cfmeta

# Virtual environment
.venv/
.venv/
5 changes: 2 additions & 3 deletions .safety.dependency.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
# Example:
# 40104 2022-01-15
#
63687 2024-05-01 # gitpython <3.1.41
64227 2024-05-01 # jinja2 <3.1.3
64976 2024-05-01 # django < 4.2.10
65771 2024-06-29 # https://github.com/fecgov/fecfile-web-api/issues/803

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ RUN useradd nxgu --no-create-home --home /opt/nxg_fec && chown -R nxgu:nxgu /opt
USER nxgu

EXPOSE 8080
ENTRYPOINT ["/bin/sh", "-c", "python wait_for_db.py && python manage.py migrate && python manage.py loaddata fixtures/e2e-test-data.json && python manage.py load_committee_data && python manage.py create_committee_views && gunicorn --bind 0.0.0.0:8080 fecfiler.wsgi -w 9 --reload"]
ENTRYPOINT ["/bin/sh", "-c", "python wait_for_db.py && python manage.py migrate && python manage.py loaddata fixtures/e2e-test-data.json && python manage.py load_committee_data && python manage.py create_committee_views && gunicorn --bind 0.0.0.0:8080 fecfiler.wsgi -w 9 --reload"]
2 changes: 1 addition & 1 deletion Dockerfile-e2e
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ RUN useradd nxgu --no-create-home --home /opt/nxg_fec_e2e && chown -R nxgu:nxgu
USER nxgu

EXPOSE 8080
ENTRYPOINT ["/bin/sh", "-c", "python wait_for_db.py && python manage.py migrate && python manage.py loaddata fixtures/e2e-test-data.json && python manage.py load_committee_data && python manage.py create_committee_views && gunicorn --bind 0.0.0.0:8080 fecfiler.wsgi -w 9 --reload"]
ENTRYPOINT ["/bin/sh", "-c", "python wait_for_db.py && python manage.py migrate && python manage.py loaddata fixtures/e2e-test-data.json && python manage.py load_committee_data && python manage.py create_committee_views && gunicorn --bind 0.0.0.0:8080 fecfiler.wsgi -w 9 --reload"]
29 changes: 29 additions & 0 deletions django-backend/fecfiler/mock_openfec/mock_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,35 @@
redis_instance = redis.Redis.from_url(MOCK_OPENFEC_REDIS_URL)


def committee(committee_id):
if redis_instance:
committee_data = redis_instance.get(COMMITTEE_DATA_REDIS_KEY) or ""
committees = json.loads(committee_data) or []
committee = next(
(
committee
for committee in committees
if committee.get("committee_id") == committee_id
),
None,
)
if committee:
# rename key so we can use same mock data for both
# query_filings and committee details endpoints
committee['name'] = committee.pop('committee_name')
return { # same as api.open.fec.gov
"api_version": "1.0",
"results": [committee],
"pagination": {
"pages": 1,
"per_page": 20,
"count": 1,
"page": 1,
},
}
return None


def query_filings(query, form_type):
if redis_instance:
committee_data = redis_instance.get(COMMITTEE_DATA_REDIS_KEY) or ""
Expand Down
Loading

0 comments on commit 8aab0a2

Please sign in to comment.