-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix feature tests #1263
fix feature tests #1263
Changes from all commits
a9f2932
9921054
1a3aee9
0ef304f
4eba3f9
856d8c5
a48ed81
363e390
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
"""Data migration which loads sample data. | ||
Set environment variable DJANGO_LOAD_SAMPLE_DATA to False to skip loading sample data. | ||
""" | ||
import json | ||
import os | ||
|
||
from django.conf import settings | ||
|
@@ -201,14 +202,19 @@ def load_sample_data(app, *args, **kwargs): | |
|
||
TransitAgency = app.get_model("core", "TransitAgency") | ||
|
||
# load the sample data from a JSON file so that it can be accessed by Cypress as well | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See this note. Essentially going back to fixtures, just for the sake of the sample data. Doesn't change anything in Azure. |
||
sample_agency_data = os.path.join(os.path.dirname(__file__), "sample_agency.json") | ||
with open(sample_agency_data) as f: | ||
sample_agency = json.load(f) | ||
|
||
mst_agency = TransitAgency.objects.create( | ||
slug="mst", | ||
short_name=os.environ.get("MST_AGENCY_SHORT_NAME", "MST (sample)"), | ||
long_name=os.environ.get("MST_AGENCY_LONG_NAME", "Monterey-Salinas Transit (sample)"), | ||
agency_id="mst", | ||
merchant_id="mst", | ||
info_url="https://mst.org/benefits", | ||
phone="888-678-2871", | ||
slug=sample_agency["slug"], | ||
short_name=os.environ.get("MST_AGENCY_SHORT_NAME", sample_agency["short_name"]), | ||
long_name=os.environ.get("MST_AGENCY_LONG_NAME", sample_agency["long_name"]), | ||
agency_id=sample_agency["agency_id"], | ||
merchant_id=sample_agency["merchant_id"], | ||
info_url=sample_agency["info_url"], | ||
phone=sample_agency["phone"], | ||
active=True, | ||
private_key=client_private_key, | ||
public_key=client_public_key, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"slug": "mst", | ||
"short_name": "MST (sample)", | ||
"long_name": "Monterey-Salinas Transit (sample)", | ||
"agency_id": "mst", | ||
"merchant_id": "mst", | ||
"info_url": "https://mst.org/benefits", | ||
"phone": "888-678-2871" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,8 @@ CYPRESS_baseUrl=http://localhost:8000 npm run cypress:open | |
|
||
See `tests/cypress/package.json` for more cypress scripts. | ||
|
||
As of Cypress 12.5.1 with Firefox 109, there is a CSRF issue that prevents the tests from passing; unclear if this is a bug in Cypress or what. Use one of the other browser options. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tricksy. |
||
|
||
## Pytest | ||
|
||
The tests done at a request/unit level are run via [pytest-django](https://pytest-django.readthedocs.io/en/latest/index.html). | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The [user data](users.json) corresponds to [the sample data for the eligibility server](https://github.com/cal-itp/eligibility-server/blob/dev/data/server.json). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
const agencies = require("../../../fixtures/05_transitagency.json"); | ||
const agency = require("../../../benefits/core/migrations/sample_agency.json"); | ||
const agencies = [{ fields: agency }]; | ||
|
||
export default agencies; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,10 @@ | ||
{ | ||
"eligible": { | ||
"name": "Garcia", | ||
"sub": "A1234567" | ||
"name": "Gonzales", | ||
"sub": "32587" | ||
}, | ||
"ineligible": { | ||
"name": "Bob", | ||
"sub": "A1234567" | ||
}, | ||
"invalidSub": { | ||
"name": "Garcia", | ||
"sub": "A12347" | ||
"sub": "12345" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was able to simplify, and more closely match our local setup.