diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 92fa0cd48..1f57250fd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -60,7 +60,7 @@ repos: - id: flake8 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.950 + rev: v0.960 hooks: - id: mypy args: [--ignore-missing-imports] diff --git a/requirements-base.txt b/requirements-base.txt index 2f67dc6c8..655e3232d 100644 --- a/requirements-base.txt +++ b/requirements-base.txt @@ -1,5 +1,5 @@ # File generated automatically. Do not update it manually. # Update files in the requirements folder instead. -pip==22.0.4 -setuptools==62.2.0 +pip==22.1.1 +setuptools==62.3.2 wheel==0.37.1 diff --git a/requirements-dev.txt b/requirements-dev.txt index ebba6108e..7fe32c869 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,17 +1,17 @@ # File generated automatically. Do not update it manually. # Update files in the requirements folder instead. alembic==1.7.7 -anyio==3.5.0 -apispec==5.2.1 +anyio==3.6.1 +apispec==5.2.2 apispec-webframeworks==0.5.2 -asgiref==3.5.1 +asgiref==3.5.2 astroid==2.11.5 attrs==21.4.0 black==22.3.0 -boto3==1.22.11 -botocore==1.25.11 +boto3==1.23.10 +botocore==1.26.10 callee==0.3.1 -certifi==2021.10.8 +certifi==2022.5.18.1 cffi==1.15.0 cfgv==3.3.1 charset-normalizer==2.0.12 @@ -20,19 +20,19 @@ content-size-limit-asgi==0.1.5 cryptography==37.0.2 decopatch==1.4.10 dependency-injector==4.39.1 -dill==0.3.4 +dill==0.3.5.1 distlib==0.3.4 factory-boy==3.2.1 -Faker==13.11.0 -fastapi==0.77.1 -filelock==3.6.0 +Faker==13.12.0 +fastapi==0.78.0 +filelock==3.7.0 Flask==2.1.2 freezegun==1.2.1 funcy==1.17 greenlet==1.1.2 gunicorn==20.1.0 h11==0.13.0 -identify==2.5.0 +identify==2.5.1 idna==3.3 iniconfig==1.1.1 isort==5.10.1 @@ -43,13 +43,13 @@ lazy-object-proxy==1.7.1 makefun==1.13.1 Mako==1.2.0 MarkupSafe==2.1.1 -marshmallow==3.15.0 +marshmallow==3.16.0 marshmallow-dataclass==8.5.3 marshmallow-enum==1.5.1 mccabe==0.7.0 more-itertools==8.13.0 -moto==3.1.8 -mypy==0.950 +moto==3.1.11 +mypy==0.960 mypy-extensions==0.4.3 nodeenv==1.6.0 packaging==21.3 @@ -61,23 +61,23 @@ pre-commit==2.19.0 psycopg2-binary==2.9.3 py==1.11.0 pycparser==2.21 -pydantic==1.9.0 -pylint==2.13.8 +pydantic==1.9.1 +pylint==2.13.9 pyparsing==3.0.9 pytest==7.1.2 -pytest-cases==3.6.11 +pytest-cases==3.6.13 pytest-freezegun==0.4.2 pytest-mock==3.7.0 pytest-pycharm==0.7.0 pytest-responses==0.5.0 python-dateutil==2.8.2 python-dotenv==0.20.0 -python-magic==0.4.25 +python-magic==0.4.26 python-multipart==0.0.5 pytz==2022.1 PyYAML==6.0 requests==2.27.1 -responses==0.20.0 +responses==0.21.0 s3transfer==0.5.2 sentry-sdk==1.5.12 six==1.16.0 diff --git a/requirements.txt b/requirements.txt index ee279374f..381d37f5c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,16 +1,16 @@ # File generated automatically. Do not update it manually. # Update files in the requirements folder instead. alembic==1.7.7 -anyio==3.5.0 -asgiref==3.5.1 -boto3==1.22.11 -botocore==1.25.11 -certifi==2021.10.8 +anyio==3.6.1 +asgiref==3.5.2 +boto3==1.23.10 +botocore==1.26.10 +certifi==2022.5.18.1 charset-normalizer==2.0.12 click==8.1.3 content-size-limit-asgi==0.1.5 dependency-injector==4.39.1 -fastapi==0.77.1 +fastapi==0.78.0 funcy==1.17 greenlet==1.1.2 gunicorn==20.1.0 @@ -19,7 +19,7 @@ idna==3.3 jmespath==1.0.0 Mako==1.2.0 MarkupSafe==2.1.1 -marshmallow==3.15.0 +marshmallow==3.16.0 marshmallow-dataclass==8.5.3 marshmallow-enum==1.5.1 more-itertools==8.13.0 @@ -27,11 +27,11 @@ mypy-extensions==0.4.3 packaging==21.3 pika==1.2.1 psycopg2-binary==2.9.3 -pydantic==1.9.0 +pydantic==1.9.1 pyparsing==3.0.9 python-dateutil==2.8.2 python-dotenv==0.20.0 -python-magic==0.4.25 +python-magic==0.4.26 python-multipart==0.0.5 requests==2.27.1 s3transfer==0.5.2 diff --git a/tests/api/namespace/use_case/test_clone_use_case.py b/tests/api/namespace/use_case/test_clone_use_case.py index 7cc8495cc..b54957f42 100644 --- a/tests/api/namespace/use_case/test_clone_use_case.py +++ b/tests/api/namespace/use_case/test_clone_use_case.py @@ -9,6 +9,7 @@ from tests.factories.use_case_factory import UseCaseFactory from tests.factories.use_case_version_factory import UseCaseVersionFactory from tests.factories.variable_factory import VariableFactory +from use_case_executor.adapters.database_repository.models import UseCaseVersion from use_case_executor.adapters.database_repository.models.use_case import UseCase from use_case_executor.adapters.database_repository.models.variable import Variable from use_case_executor.domain.flow.edge_data.quick_reply_data import QuickReplyData @@ -260,14 +261,13 @@ def test_clone_use_case_on_a_use_case_with_production_only_setting( assert new_use_case.service_record_id == payload["service_record_id"] assert new_use_case.intent_record_id == payload["intent_record_id"] + assert new_use_case.production_version_id is None if has_production_flow: assert len(new_use_case.versions) == 1 version = new_use_case.versions[0] - assert new_use_case.production_version_id == version.id assert version.flow == prod_version.flow else: assert len(new_use_case.versions) == 0 - assert new_use_case.production_version_id is None assert response.json() == { "instance_id": payload["instance_id"], @@ -538,10 +538,12 @@ def test_creates_new_variables_if_cloning_to_other_instance( # pylint: disable= assert new_variable.name == variable.name assert new_variable.type == variable.type - new_use_case = session.query(UseCase).filter(UseCase.uuid != use_case.uuid).one() - new_flow = common.dict_flow_to_domain_flow( - flow=new_use_case.production_version.flow + new_use_case_version = ( + session.query(UseCaseVersion) + .filter(UseCaseVersion.use_case_uuid != use_case.uuid) + .one() ) + new_flow = common.dict_flow_to_domain_flow(flow=new_use_case_version.flow) new_answer_node_data = new_flow.get_node(uuid=answer_node_uuid).data assert isinstance(new_answer_node_data, AnswerData) diff --git a/use_case_executor/api/namespaces/use_cases/clone.py b/use_case_executor/api/namespaces/use_cases/clone.py index e13efb7c2..ac2845fce 100644 --- a/use_case_executor/api/namespaces/use_cases/clone.py +++ b/use_case_executor/api/namespaces/use_cases/clone.py @@ -39,9 +39,6 @@ def clone_use_case( service_record_id=clone_use_case_model_in.service_record_id, intent_record_id=clone_use_case_model_in.intent_record_id, flow=flow_to_clone, - set_new_version_as_production=( - clone_behavior == CloneBehavior.PRODUCTION_FLOW_ONLY - ), clone_variables=(clone_use_case_model_in.instance_id != use_case.instance_id), ) session.commit() @@ -90,9 +87,6 @@ def clone_use_case_as_main_menu( service_record_id=clone_use_case_as_main_menu_model_in.service_record_id, intent_record_id=clone_use_case_as_main_menu_model_in.intent_record_id, flow=flow_to_clone, - set_new_version_as_production=( - clone_behavior == CloneBehavior.PRODUCTION_FLOW_ONLY - ), clone_variables=False, ) session.commit() diff --git a/use_case_executor/api/namespaces/use_cases/clone_helpers.py b/use_case_executor/api/namespaces/use_cases/clone_helpers.py index 3faf80183..2cdf9ce34 100644 --- a/use_case_executor/api/namespaces/use_cases/clone_helpers.py +++ b/use_case_executor/api/namespaces/use_cases/clone_helpers.py @@ -55,7 +55,6 @@ def create_new_use_case_and_version( intent_record_id: int, service_record_id: int, flow: Optional[dict], - set_new_version_as_production: bool, clone_variables: bool, ) -> UseCase: new_use_case = UseCase( @@ -75,9 +74,6 @@ def create_new_use_case_and_version( ) new_use_case.versions.append(new_version) - if set_new_version_as_production: - new_use_case.production_version = new_version - with helpers.handle_use_case_unique_violations(): session.flush()