1919
2020from fastapi_jsonapi .views .view_base import ViewBase
2121from tests .common import is_postgres_tests
22- from tests .fixtures .app import ResourceInfoDTO , build_app_custom , build_custom_app_by_schemas
22+ from tests .fixtures .app import build_alphabet_app , build_app_custom
2323from tests .fixtures .entities import build_workplace , create_user
2424from tests .misc .utils import fake
2525from tests .models import (
3838 Workplace ,
3939)
4040from tests .schemas import (
41- AlphaSchema ,
42- BetaSchema ,
4341 CustomUserAttributesSchema ,
4442 CustomUUIDItemAttributesSchema ,
45- DeltaSchema ,
46- GammaSchema ,
4743 PostAttributesBaseSchema ,
4844 PostCommentAttributesBaseSchema ,
4945 SelfRelationshipSchema ,
@@ -2752,70 +2748,27 @@ async def test_join_by_relationships_for_one_model_by_different_join_chains(
27522748 self ,
27532749 async_session : AsyncSession ,
27542750 ):
2755- app = build_custom_app_by_schemas (
2756- [
2757- ResourceInfoDTO (
2758- path = "/alpha" ,
2759- resource_type = "alpha" ,
2760- model = Alpha ,
2761- schema_ = AlphaSchema ,
2762- ),
2763- ResourceInfoDTO (
2764- path = "/beta" ,
2765- resource_type = "beta" ,
2766- model = Beta ,
2767- schema_ = BetaSchema ,
2768- ),
2769- ResourceInfoDTO (
2770- path = "/gamma" ,
2771- resource_type = "gamma" ,
2772- model = Gamma ,
2773- schema_ = GammaSchema ,
2774- ),
2775- ResourceInfoDTO (
2776- path = "/delta" ,
2777- resource_type = "delta" ,
2778- model = Delta ,
2779- schema_ = DeltaSchema ,
2780- ),
2781- ],
2782- )
2783-
2784- # acc_1 = Account(name="account-1")
2785- # role_1 = Role(delta=acc_1)
2786- # user_1 = User()
2751+ app = build_alphabet_app ()
27872752
27882753 delta_1 = Delta (name = "delta_1" )
2789- beta_1 , beta_2 = Beta (), Beta ()
2754+ delta_1 . betas = [ beta_1 : = Beta ()]
27902755
27912756 gamma_1 = Gamma (delta = delta_1 )
27922757 gamma_1 .betas = [beta_1 ]
2793- gamma_2 = Gamma (delta = delta_1 )
2794- gamma_2 .betas = [beta_2 ]
2795- delta_1 .betas = [beta_1 , beta_2 ]
27962758
27972759 delta_2 = Delta (name = "delta_2" )
2798- beta_3 = Beta ()
2799- beta_4 = Beta ()
2800- gamma_3 = Gamma (delta = delta_2 )
2801- gamma_3 .betas = [beta_3 ]
2802- gamma_4 = Gamma (delta = delta_2 )
2803- gamma_4 .betas = [beta_4 ]
2804- delta_2 .betas = [beta_3 , beta_4 ]
2760+ gamma_2 = Gamma (delta = delta_2 )
28052761
2806- alpha_1 = Alpha (beta = beta_1 , gamma = gamma_3 )
2807- alpha_2 = Alpha (beta = beta_3 , gamma = gamma_3 )
2762+ alpha_1 = Alpha (beta = beta_1 , gamma = gamma_2 )
28082763
28092764 async_session .add_all (
28102765 [
28112766 delta_1 ,
28122767 delta_2 ,
2768+ beta_1 ,
28132769 gamma_1 ,
28142770 gamma_2 ,
2815- gamma_3 ,
2816- gamma_4 ,
28172771 alpha_1 ,
2818- alpha_2 ,
28192772 ],
28202773 )
28212774 await async_session .commit ()
@@ -2824,8 +2777,16 @@ async def test_join_by_relationships_for_one_model_by_different_join_chains(
28242777 params = {
28252778 "filter" : json .dumps (
28262779 [
2827- {"name" : "beta.gammas.delta.name" , "op" : "ilike" , "val" : delta_1 .name },
2828- {"name" : "gamma.delta.name" , "op" : "ilike" , "val" : delta_2 .name },
2780+ {
2781+ "name" : "beta.gammas.delta.name" ,
2782+ "op" : "eq" ,
2783+ "val" : delta_1 .name ,
2784+ },
2785+ {
2786+ "name" : "gamma.delta.name" ,
2787+ "op" : "eq" ,
2788+ "val" : delta_2 .name ,
2789+ },
28292790 ],
28302791 ),
28312792 }
0 commit comments