Skip to content
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

Bump flake8 from 7.0.0 to 7.1.1 #17

Merged
merged 4 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from app.create_app import app # noqa
from app.create_app import app # noqa
1 change: 0 additions & 1 deletion app/blueprints/self_serve/data/data_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from app.blueprints.self_serve.data.not_a_db import LISTS
from app.blueprints.self_serve.data.not_a_db import PAGES
from app.blueprints.self_serve.data.not_a_db import SECTIONS
from app.db.queries.application import insert_new_section

saved_responses = []
saved_sections = {}
Expand Down
2 changes: 1 addition & 1 deletion app/create_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ def create_app() -> Flask:
return flask_app


app = create_app()
app = create_app()
9 changes: 6 additions & 3 deletions app/db/queries/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ def insert_new_section(new_section_config):
new_section_config (dict): A dictionary containing the configuration for the new section.
new_section_config keys:
- round_id (str): The ID of the round to which the section belongs.
- name_in_apply_json (dict): The name of the section as it will be in the Application JSON (support multiple languages/keys).
- name_in_apply_json (dict): The name of the section as it will be in the Application
JSON (support multiple languages/keys).
- template_name (str): The name of the template.
- is_template (bool): A flag indicating whether the section is a template.
- source_template_id (str): The ID of the source template.
Expand Down Expand Up @@ -266,7 +267,8 @@ def insert_new_form(new_form_config):
new_form_config (dict): A dictionary containing the configuration for the new form.
new_form_config keys:
- section_id (str): The ID of the section to which the form belongs.
- name_in_apply_json (dict): The name of the form as it will be in the Application JSON (support multiple languages/keys).
- name_in_apply_json (dict): The name of the form as it will be in the Application
JSON (support multiple languages/keys).
- is_template (bool): A flag indicating whether the form is a template.
- template_name (str): The name of the template.
- source_template_id (str): The ID of the source template.
Expand Down Expand Up @@ -412,7 +414,8 @@ def insert_new_component(new_component_config: dict):
- audit_info (dict): Audit information for the component.
- page_index (int): The index of the component within the page.
- theme_index (int): The index of the component within the theme.
- conditions (dict): The conditions such as potential routes based on the components value (can specify page path).
- conditions (dict): The conditions such as potential routes based on the
components value (can specify page path).
- runner_component_name (str): The name of the runner component.
- list_id (str): The ID of the list to which the component belongs.
Returns:
Expand Down
4 changes: 3 additions & 1 deletion config/envs/dev.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""Flask configuration."""

import logging
from os import environ

from config.envs.default import DefaultConfig
from fsd_utils import configclass

from config.envs.default import DefaultConfig


@configclass
class DevConfig(DefaultConfig):
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ python-dotenv
#-----------------------------------
# Code Quality
#-----------------------------------
flake8==7.0.0
flake8==7.1.1
flake8-pyproject==1.2.3
black==24.8.0
djlint
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ et-xmlfile==1.1.0
# via openpyxl
filelock==3.15.4
# via virtualenv
flake8==7.0.0
flake8==7.1.1
# via
# -r requirements-dev.in
# flake8-pyproject
Expand Down Expand Up @@ -211,7 +211,7 @@ pre-commit==3.7.1
# via -r requirements-dev.in
psycopg2-binary==2.9.9
# via -r requirements.in
pycodestyle==2.11.1
pycodestyle==2.12.1
# via flake8
pycparser==2.22
# via cffi
Expand Down
3 changes: 2 additions & 1 deletion tasks/db_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import sys
from os import getenv

from app import app
from invoke import task # noqa:E402

from app import app

sys.path.insert(1, ".")
os.environ.update({"FLASK_ENV": "tasks"})

Expand Down
77 changes: 38 additions & 39 deletions tests/test_db_template_CRUD.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import uuid
from copy import deepcopy

from sqlalchemy.exc import IntegrityError

from app.db.models import ComponentType
from app.db.models.application_config import Component
from app.db.models.application_config import Form
Expand Down Expand Up @@ -51,17 +53,17 @@ def test_insert_new_section(flask_test_client, _db, clear_test_data, seed_dynami
assert template_section.round_id == new_template_section_config["round_id"]
assert template_section.name_in_apply_json == new_template_section_config["name_in_apply_json"]
assert template_section.template_name == new_template_section_config["template_name"]
assert template_section.is_template == True
assert new_section.source_template_id == None
assert template_section.is_template is True
assert new_section.source_template_id is None
assert template_section.audit_info == new_template_section_config["audit_info"]
assert template_section.index == new_template_section_config["index"]

assert isinstance(new_section, Section)
assert new_section.round_id == new_section_config["round_id"]
assert new_section.name_in_apply_json == new_section_config["name_in_apply_json"]
assert new_section.template_name == None
assert new_section.is_template == False
assert new_section.source_template_id == None
assert new_section.template_name is None
assert new_section.is_template is False
assert new_section.source_template_id is None
assert new_section.audit_info == new_section_config["audit_info"]
assert new_section.index == new_section_config["index"]

Expand All @@ -73,9 +75,9 @@ def test_update_section(flask_test_client, _db, clear_test_data, seed_dynamic_da

assert new_section.round_id == new_section_config["round_id"]
assert new_section.name_in_apply_json == new_section_config["name_in_apply_json"]
assert new_section.template_name == None
assert new_section.is_template == False
assert new_section.source_template_id == None
assert new_section.template_name is None
assert new_section.is_template is False
assert new_section.source_template_id is None
assert new_section.audit_info == new_section_config["audit_info"]
assert new_section.index == new_section_config["index"]

Expand All @@ -101,10 +103,7 @@ def test_delete_section(flask_test_client, _db, clear_test_data, seed_dynamic_da
assert new_section.audit_info == new_section_config["audit_info"]

delete_section(new_section.section_id)
assert _db.session.query(Section).filter(Section.section_id == new_section.section_id).one_or_none() == None


from sqlalchemy.exc import IntegrityError
assert _db.session.query(Section).filter(Section.section_id == new_section.section_id).one_or_none() is None


def test_failed_delete_section_with_fk_to_forms(flask_test_client, _db, clear_test_data, seed_dynamic_data):
Expand Down Expand Up @@ -162,19 +161,19 @@ def test_insert_new_form(flask_test_client, _db, clear_test_data, seed_dynamic_d
assert new_template_form.section_id == new_template_form_config["section_id"]
assert new_template_form.name_in_apply_json == new_template_form_config["name_in_apply_json"]
assert new_template_form.template_name == new_template_form_config["template_name"]
assert new_template_form.is_template == True
assert new_template_form.source_template_id == None
assert new_template_form.is_template is True
assert new_template_form.source_template_id is None
assert new_template_form.audit_info == new_template_form_config["audit_info"]
assert new_template_form.section_index == new_template_form_config["section_index"]
assert new_template_form.runner_publish_name == None
assert new_template_form.runner_publish_name is None

new_form = insert_new_form(new_form_config)
assert isinstance(new_form, Form)
assert new_form.section_id == new_form_config["section_id"]
assert new_form.name_in_apply_json == new_form_config["name_in_apply_json"]
assert new_form.template_name == None
assert new_form.source_template_id == None # not cloned, its a new non-template form
assert new_form.is_template == False
assert new_form.template_name is None
assert new_form.source_template_id is None # not cloned, its a new non-template form
assert new_form.is_template is False
assert new_form.audit_info == new_form_config["audit_info"]
assert new_form.section_index == new_form_config["section_index"]
assert new_form.runner_publish_name == new_form_config["runner_publish_name"]
Expand All @@ -193,9 +192,9 @@ def test_update_form(flask_test_client, _db, clear_test_data, seed_dynamic_data)

assert new_form.section_id == new_form_config["section_id"]
assert new_form.name_in_apply_json == new_form_config["name_in_apply_json"]
assert new_form.template_name == None
assert new_form.is_template == False
assert new_form.source_template_id == None
assert new_form.template_name is None
assert new_form.is_template is False
assert new_form.source_template_id is None
assert new_form.audit_info == new_form_config["audit_info"]
assert new_form.section_index == new_form_config["section_index"]
assert new_form.runner_publish_name == new_form_config["runner_publish_name"]
Expand Down Expand Up @@ -224,7 +223,7 @@ def test_delete_form(flask_test_client, _db, clear_test_data, seed_dynamic_data)
assert new_form.audit_info == new_form_config["audit_info"]

delete_form(new_form.form_id)
assert _db.session.query(Form).filter(Form.form_id == new_form.form_id).one_or_none() == None
assert _db.session.query(Form).filter(Form.form_id == new_form.form_id).one_or_none() is None


def test_failed_delete_form_with_fk_to_page(flask_test_client, _db, clear_test_data, seed_dynamic_data):
Expand Down Expand Up @@ -283,8 +282,8 @@ def test_insert_new_page(flask_test_client, _db, clear_test_data, seed_dynamic_d
assert new_template_page.form_id is None
assert new_template_page.name_in_apply_json == new_template_page_config["name_in_apply_json"]
assert new_template_page.template_name == new_template_page_config["template_name"]
assert new_template_page.is_template == True
assert new_template_page.source_template_id == None
assert new_template_page.is_template is True
assert new_template_page.source_template_id is None
assert new_template_page.audit_info == new_template_page_config["audit_info"]
assert new_template_page.form_index == new_template_page_config["form_index"]
assert new_template_page.display_path == new_page_config["display_path"]
Expand All @@ -294,9 +293,9 @@ def test_insert_new_page(flask_test_client, _db, clear_test_data, seed_dynamic_d
assert isinstance(new_page, Page)
assert new_page.form_id == new_page_config["form_id"]
assert new_page.name_in_apply_json == new_page_config["name_in_apply_json"]
assert new_page.template_name == None
assert new_page.is_template == False
assert new_page.source_template_id == None
assert new_page.template_name is None
assert new_page.is_template is False
assert new_page.source_template_id is None
assert new_page.audit_info == new_page_config["audit_info"]
assert new_page.form_index == new_page_config["form_index"]
assert new_page.display_path == new_page_config["display_path"]
Expand All @@ -309,9 +308,9 @@ def test_update_page(flask_test_client, _db, clear_test_data, seed_dynamic_data)

assert new_page.form_id is None
assert new_page.name_in_apply_json == new_page_config["name_in_apply_json"]
assert new_page.template_name == None
assert new_page.is_template == False
assert new_page.source_template_id == None
assert new_page.template_name is None
assert new_page.is_template is False
assert new_page.source_template_id is None
assert new_page.audit_info == new_page_config["audit_info"]
assert new_page.form_index == new_page_config["form_index"]
assert new_page.display_path == new_page_config["display_path"]
Expand All @@ -338,7 +337,7 @@ def test_delete_page(flask_test_client, _db, clear_test_data, seed_dynamic_data)
assert new_page.audit_info == new_page_config["audit_info"]

delete_page(new_page.page_id)
assert _db.session.query(Page).filter(Page.page_id == new_page.page_id).one_or_none() == None
assert _db.session.query(Page).filter(Page.page_id == new_page.page_id).one_or_none() is None


def test_failed_delete_page_with_fk_to_component(flask_test_client, _db, clear_test_data, seed_dynamic_data):
Expand Down Expand Up @@ -448,9 +447,9 @@ def test_insert_new_component(flask_test_client, _db, clear_test_data, seed_dyna
assert component.hint_text == new_component_config["hint_text"]
assert component.options == new_component_config["options"]
assert component.type == new_component_config["type"]
assert component.is_template == False
assert component.template_name == None
assert component.source_template_id == None
assert component.is_template is False
assert component.template_name is None
assert component.source_template_id is None
assert component.audit_info == new_component_config["audit_info"]
assert component.page_index == new_component_config["page_index"]
assert component.theme_index == new_component_config["theme_index"]
Expand All @@ -466,9 +465,9 @@ def test_insert_new_component(flask_test_client, _db, clear_test_data, seed_dyna
assert template_component.hint_text == new_template_component_config["hint_text"]
assert template_component.options == new_template_component_config["options"]
assert template_component.type == new_template_component_config["type"]
assert template_component.is_template == True
assert template_component.is_template is True
assert template_component.template_name == new_template_component_config["template_name"]
assert template_component.source_template_id == None
assert template_component.source_template_id is None
assert template_component.audit_info == new_template_component_config["audit_info"]
assert template_component.page_index == new_template_component_config["page_index"]
assert template_component.theme_index == new_template_component_config["theme_index"]
Expand All @@ -489,7 +488,7 @@ def test_update_component(flask_test_client, _db, clear_test_data, seed_dynamic_

assert component.title == new_component_config["title"]
assert component.audit_info == new_component_config["audit_info"]
assert component.is_template == False
assert component.is_template is False

# Update new_component_config
updated_component_config = deepcopy(new_component_config)
Expand All @@ -501,7 +500,7 @@ def test_update_component(flask_test_client, _db, clear_test_data, seed_dynamic_
assert isinstance(updated_component, Component)
assert updated_component.title == updated_component_config["title"]
assert updated_component.audit_info == updated_component_config["audit_info"]
assert updated_component.is_template == False
assert updated_component.is_template is False


def test_delete_component(flask_test_client, _db, clear_test_data, seed_dynamic_data):
Expand All @@ -518,4 +517,4 @@ def test_delete_component(flask_test_client, _db, clear_test_data, seed_dynamic_
assert component.audit_info == new_component_config["audit_info"]

delete_component(component.component_id)
assert _db.session.query(Component).filter(Component.component_id == component.component_id).one_or_none() == None
assert _db.session.query(Component).filter(Component.component_id == component.component_id).one_or_none() is None