Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jessemortenson committed Jan 10, 2025
1 parent c4d0c3a commit 820f7fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion api/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,11 @@ class BillSponsorship(BaseModel):
person: Optional[CompactPerson]
primary: bool
classification: str = Field(..., example="primary")

class Config:
orm_mode = True


class BillActionRelatedEntity(BaseModel):
name: str = Field(..., example="Senate Committee of the Whole")
entity_type: str = Field(..., example="organization")
Expand Down Expand Up @@ -316,6 +317,7 @@ class PersonVote(BaseModel):
class Config:
orm_mode = True


class VoteEvent(BaseModel):
id: str
motion_text: str = Field(..., example="Shall the bill be passed?")
Expand Down
16 changes: 8 additions & 8 deletions api/tests/test_bills.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def test_bills_include_documents_versions(client):
assert len(b["documents"]) == 3
assert len(b["versions"]) == 2
version = b["versions"][0]
version_id = version.pop("id") # they are dynamic uuids so...
version_id = version.pop("id") # they are dynamic uuids so...
assert uuid.UUID(version_id)
assert isinstance(version_id, str)
assert version == {
Expand All @@ -229,11 +229,10 @@ def test_bills_include_votes(client):
votes = b["votes"]
for vote in votes:
for person_vote in vote["votes"]:
vote_people_id = person_vote.pop("id")
vote_people_id = person_vote.pop("id")
assert uuid.UUID(vote_people_id)
assert isinstance(vote_people_id, str)


assert b["votes"] == [
{
"id": "ocd-vote/1",
Expand Down Expand Up @@ -411,23 +410,24 @@ def test_bill_detail_sponsorship_resolution(client):
}
assert query_logger.count == 3


def test_bills_include_actions(client):
response = client.get("/bills?jurisdiction=ne&session=2020&include=actions")

for bill in response.json()["results"]:
assert "actions" in bill
assert len(bill["actions"]) > 0

for action in bill["actions"]:
action_id = action.pop("id")
assert uuid.UUID(action_id)

assert action["description"]
assert action["date"]
assert action["date"]
assert isinstance(action["classification"], list)
assert isinstance(action["organization"], dict)
assert isinstance(action["related_entities"], list)

assert "id" in action["organization"]
org_id = action["organization"]["id"]
assert isinstance(org_id, str)
Expand All @@ -437,4 +437,4 @@ def test_bills_include_actions(client):
for entity in action["related_entities"]:
assert "id" in entity
assert "name" in entity
assert "type" in entity
assert "type" in entity

0 comments on commit 820f7fa

Please sign in to comment.