@@ -46,6 +46,77 @@ def __init__(self, *args, **kwargs):
4646 assert res .status_code == 400
4747
4848
49+ @pytest .mark .parametrize ("spec" , SPECS )
50+ def test_validator_map_ft_authz_success (json_validation_spec_dir , spec ):
51+ app = App (__name__ , specification_dir = json_validation_spec_dir )
52+ app .add_api (spec , validate_responses = True )
53+ app_client = app .app .test_client ()
54+
55+ res = app_client .get ("/v1.0/authzEnd" ) # type: flask.Response
56+ assert res .status_code == 200
57+
58+
59+ @pytest .mark .parametrize ("spec" , SPECS )
60+ def test_validator_map_ft_authz_list_success (json_validation_spec_dir , spec ):
61+ app = App (__name__ , specification_dir = json_validation_spec_dir )
62+ app .add_api (spec , validate_responses = True )
63+ app_client = app .app .test_client ()
64+
65+ res = app_client .get ("/v1.0/authzEndList" ) # type: flask.Response
66+
67+ assert res .status_code == 200
68+
69+
70+ @pytest .mark .parametrize ("spec" , SPECS )
71+ def test_validator_map_ft_authz_success_extra_auth (json_validation_spec_dir , spec ):
72+ app = App (__name__ , specification_dir = json_validation_spec_dir )
73+ app .add_api (spec , validate_responses = True )
74+ app_client = app .app .test_client ()
75+
76+ res = app_client .get ("/v1.0/authzEndExtraFunc" ) # type: flask.Response
77+ assert res .status_code == 200
78+
79+
80+ @pytest .mark .parametrize ("spec" , SPECS )
81+ def test_validator_map_ft_authz_extra_auth_fails (json_validation_spec_dir , spec ):
82+ app = App (__name__ , specification_dir = json_validation_spec_dir )
83+ app .add_api (spec , validate_responses = True )
84+ app_client = app .app .test_client ()
85+
86+ res = app_client .get ("/v1.0/authzEndExtraFuncFail" ) # type: flask.Response
87+ assert res .status_code == 401
88+
89+
90+ @pytest .mark .parametrize ("spec" , SPECS )
91+ def x_test_validator_map_ft_authz_fails_extra_auth (json_validation_spec_dir , spec ):
92+ app = App (__name__ , specification_dir = json_validation_spec_dir )
93+ app .add_api (spec , validate_responses = True )
94+ app_client = app .app .test_client ()
95+
96+ res = app_client .get ("/v1.0/authzEndExtraFuncFails" ) # type: flask.Response
97+ assert res .status_code == 200
98+
99+
100+ @pytest .mark .parametrize ("spec" , SPECS )
101+ def test_validator_map_ft_authz_fail (json_validation_spec_dir , spec ):
102+ app = App (__name__ , specification_dir = json_validation_spec_dir )
103+ app .add_api (spec , validate_responses = True )
104+ app_client = app .app .test_client ()
105+
106+ res = app_client .get ("/v1.0/authzEndFails" ) # type: flask.Response
107+ assert res .status_code == 401 # unauthorized because of authz
108+
109+
110+ @pytest .mark .parametrize ("spec" , SPECS )
111+ def test_validator_map_ft_authz_not_set (json_validation_spec_dir , spec ):
112+ app = App (__name__ , specification_dir = json_validation_spec_dir )
113+ app .add_api (spec , validate_responses = True )
114+ app_client = app .app .test_client ()
115+
116+ res = app_client .get ("/v1.0/authzEndFails" ) # type: flask.Response
117+ assert res .status_code == 401 # unauthorized because of authz
118+
119+
49120@pytest .mark .parametrize ("spec" , SPECS )
50121def test_readonly (json_validation_spec_dir , spec ):
51122 app = build_app_from_fixture (json_validation_spec_dir , spec , validate_responses = True )
0 commit comments