Skip to content

Commit

Permalink
codeforboston#284 - Fixed style issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnuzzose committed Aug 4, 2023
1 parent 660fcb6 commit 71bfcb6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions backend/auth/jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,14 @@ def decorator(*args, **kwargs):

return wrapper


def contributor_has_organization():
def wrapper(fn):
@wraps(fn)
def decorator(*args, **kwargs):
if verify_contributor_has_organization_or_abort():
return fn(*args, **kwargs)

return decorator

return wrapper
3 changes: 2 additions & 1 deletion backend/database/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class User(db.Model, UserMixin, CrudMixin):
phone_number = db.Column(db.Text)

member_of = db.relationship(
'Organization', backref='organization', secondary='organization_user', lazy="select")
'Organization', backref='organization', secondary='organization_user',
lazy="select")

def verify_password(self, pw):
return bcrypt.checkpw(pw.encode("utf8"), self.password.encode("utf8"))
3 changes: 2 additions & 1 deletion backend/scraper/data_scrapers/scraper_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def drop_existing_records(dataset, organization):
existing_organization_ids = list(
s
for (s,) in db.session.query(md.Incident.organization_id).filter(
md.Incident.organization == organization, md.Incident.organization_id is not None
md.Incident.organization == organization,
md.Incident.organization_id is not None
)
)
return dataset.drop(existing_organization_ids)
4 changes: 2 additions & 2 deletions backend/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from datetime import datetime
from pytest_postgresql.janitor import DatabaseJanitor
from sqlalchemy import insert
from enum import Enum

example_email = "[email protected]"
admin_email = "[email protected]"
Expand Down Expand Up @@ -59,13 +58,14 @@ def example_organization(db_session):
organization = Organization(
id="example_organization",
name="Example Organization",
url = "www.example.com",
url="www.example.com",
contact_email=contributor_email,
)
db_session.add(organization)
db_session.commit()
return organization


@pytest.fixture
def example_user(db_session):
user = User(
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/test_incidents.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def example_incidents(db_session, client, contributor_access_token):
res = client.post(
"/api/v1/incidents/create",
json=mock,
headers={"Authorization":
headers={"Authorization":
"Bearer {0}".format(contributor_access_token)},
)
assert res.status_code == 200
Expand Down

0 comments on commit 71bfcb6

Please sign in to comment.