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

Make test_swagger_endpoints more verbose. #1240

Open
abragtim opened this issue Jun 27, 2023 · 1 comment
Open

Make test_swagger_endpoints more verbose. #1240

abragtim opened this issue Jun 27, 2023 · 1 comment
Labels
backend Backend related task/PR

Comments

@abragtim
Copy link
Collaborator

Teď když uděláte chybu ve swaggeru jako tady #1235 (comment),
tak uvidíte jen tohle

  File "/opt/conda/envs/txmatching/lib/python3.11/site-packages/swagger_unittest/swagger_tester/swagger_tester.py", line 87, in validate_definition
    assert len(set(valid_definition).intersection(actual_definition)) >= 1, (
AssertionError: Responses are not compatible. Definition of valid response is [] which is different than definition of actual response which is []. 
Cbc3007W No integer variables
Total time (CPU seconds):       0.00   (Wallclock seconds):       0.00

Valid response: {'hla_to_antibody': [{'antibody_matches': [{'hla_antibody': {'code': {'broad': 'A1', 'high_res': None, 'split': 'A1'}, 'cutoff': 2000, 'mfi': 3000, 'raw_code': 'A1', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:02', 'split': 'A1'}, 'display_code': 'A*01:02', 'raw_code': 'A*01:02'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:03', 'split': 'A1'}, 'display_code': 'A*01:03', 'raw_code': 'A*01:03'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:06', 'split': 'A1'}, 'display_code': 'A*01:06', 'raw_code': 'A*01:06'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:19', 'split': 'A1'}, 'display_code': 'A*01:19', 'raw_code': 'A*01:19'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'A1', 'high_res': None, 'split': 'A1'}, 'issues': ['Antibodies against this HLA Type might not be DSA, for more see detailed section.'], 'match_type': 'SPLIT', 'mfi': 3000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'A2', 'high_res': None, 'split': 'A2'}, 'display_code': 'A2', 'raw_code': 'A2'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [{'hla_antibody': {'code': {'broad': 'B7', 'high_res': None, 'split': 'B7'}, 'cutoff': 2000, 'mfi': 2000, 'raw_code': 'B7', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'B7', 'high_res': None, 'split': 'B7'}, 'display_code': 'B7', 'raw_code': 'B7'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'B7', 'high_res': None, 'split': 'B7'}, 'issues': [], 'match_type': 'SPLIT', 'mfi': 2000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'B35', 'high_res': None, 'split': 'B35'}, 'display_code': 'B35', 'raw_code': 'B35'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [{'hla_antibody': {'code': {'broad': 'DR2', 'high_res': None, 'split': 'DR15'}, 'cutoff': 2000, 'mfi': 3000, 'raw_code': 'DR15', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DR2', 'high_res': 'DRB1*15:03', 'split': 'DR15'}, 'display_code': 'DRB1*15:03', 'raw_code': 'DRB1*15:03'}, 'is_frequent': False}, {'hla_type': {'code': {'broad': 'DR2', 'high_res': 'DRB1*15:112', 'split': 'DR15'}, 'display_code': 'DRB1*15:112', 'raw_code': 'DRB1*15:112'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'DR2', 'high_res': 'DRB1*15:07', 'split': 'DR15'}, 'display_code': 'DRB1*15:07', 'raw_code': 'DRB1*15:07'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'DR2', 'high_res': None, 'split': 'DR15'}, 'issues': ['Antibodies against this HLA Type might not be DSA, for more see detailed section.'], 'match_type': 'SPLIT', 'mfi': 3000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DR5', 'high_res': 'DRB1*11:02', 'split': 'DR11'}, 'display_code': 'DRB1*11:02', 'raw_code': 'DRB1*11:02'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'DR5', 'high_res': 'DRB1*11:15', 'split': 'DR11'}, 'display_code': 'DRB1*11:15', 'raw_code': 'DRB1*11:15'}, 'is_frequent': False}, {'hla_type': {'code': {'broad': 'DR5', 'high_res': 'DRB1*11:52', 'split': 'DR11'}, 'display_code': 'DRB1*11:52', 'raw_code': 'DRB1*11:52'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [{'hla_antibody': {'code': {'broad': 'DPA2', 'high_res': 'DPA1*02:01', 'split': 'DPA2'}, 'cutoff': 2000, 'mfi': 3000, 'raw_code': 'DPA1*02:01', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DPA2', 'high_res': None, 'split': 'DPA2'}, 'display_code': 'DPA2', 'raw_code': 'DPA2'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'DPA2', 'high_res': None, 'split': 'DPA2'}, 'issues': [], 'match_type': 'SPLIT', 'mfi': 3000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DP1054', 'high_res': None, 'split': 'DP1054'}, 'display_code': 'DP1054', 'raw_code': 'DP1054'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DQA1', 'high_res': None, 'split': 'DQA1'}, 'display_code': 'DQA1', 'raw_code': 'DQA1'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DQ1', 'high_res': None, 'split': 'DQ6'}, 'display_code': 'DQ6', 'raw_code': 'DQ6'}, 'is_frequent': True}], 'summary': None}], 'parsing_issues': [{'hla_code_or_group': 'A*01:06', 'message': 'The information about the serological equivalent of the allele is only assumed in our datasource so the conversion is not 100% reliable. Please check that the conversion is correct.', 'parsing_issue_detail': 'The information about the serological equivalent of the allele is only assumed in our datasource so the conversion is not 100% reliable. Please check that the conversion is correct.'}]} 
Actual response: {'hla_to_antibody': [{'antibody_matches': [{'hla_antibody': {'code': {'broad': 'A1', 'high_res': None, 'split': 'A1'}, 'cutoff': 2000, 'mfi': 3000, 'raw_code': 'A1', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:02', 'split': 'A1'}, 'display_code': 'A*01:02', 'raw_code': 'A*01:02'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:03', 'split': 'A1'}, 'display_code': 'A*01:03', 'raw_code': 'A*01:03'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:06', 'split': 'A1'}, 'display_code': 'A*01:06', 'raw_code': 'A*01:06'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:19', 'split': 'A1'}, 'display_code': 'A*01:19', 'raw_code': 'A*01:19'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'A1', 'high_res': None, 'split': 'A1'}, 'issues': ['Antibodies against this HLA Type might not be DSA, for more see detailed section.'], 'match_type': 'SPLIT', 'mfi': 3000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'A2', 'high_res': None, 'split': 'A2'}, 'display_code': 'A2', 'raw_code': 'A2'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [{'hla_antibody': {'code': {'broad': 'B7', 'high_res': None, 'split': 'B7'}, 'cutoff': 2000, 'mfi': 2000, 'raw_code': 'B7', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'B7', 'high_res': None, 'split': 'B7'}, 'display_code': 'B7', 'raw_code': 'B7'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'B7', 'high_res': None, 'split': 'B7'}, 'issues': [], 'match_type': 'SPLIT', 'mfi': 2000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'B35', 'high_res': None, 'split': 'B35'}, 'display_code': 'B35', 'raw_code': 'B35'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [{'hla_antibody': {'code': {'broad': 'DR2', 'high_res': None, 'split': 'DR15'}, 'cutoff': 2000, 'mfi': 3000, 'raw_code': 'DR15', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DR2', 'high_res': 'DRB1*15:03', 'split': 'DR15'}, 'display_code': 'DRB1*15:03', 'raw_code': 'DRB1*15:03'}, 'is_frequent': False}, {'hla_type': {'code': {'broad': 'DR2', 'high_res': 'DRB1*15:112', 'split': 'DR15'}, 'display_code': 'DRB1*15:112', 'raw_code': 'DRB1*15:112'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'DR2', 'high_res': 'DRB1*15:07', 'split': 'DR15'}, 'display_code': 'DRB1*15:07', 'raw_code': 'DRB1*15:07'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'DR2', 'high_res': None, 'split': 'DR15'}, 'issues': ['Antibodies against this HLA Type might not be DSA, for more see detailed section.'], 'match_type': 'SPLIT', 'mfi': 3000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DR5', 'high_res': 'DRB1*11:02', 'split': 'DR11'}, 'display_code': 'DRB1*11:02', 'raw_code': 'DRB1*11:02'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'DR5', 'high_res': 'DRB1*11:15', 'split': 'DR11'}, 'display_code': 'DRB1*11:15', 'raw_code': 'DRB1*11:15'}, 'is_frequent': False}, {'hla_type': {'code': {'broad': 'DR5', 'high_res': 'DRB1*11:52', 'split': 'DR11'}, 'display_code': 'DRB1*11:52', 'raw_code': 'DRB1*11:52'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [{'hla_antibody': {'code': {'broad': 'DPA2', 'high_res': 'DPA1*02:01', 'split': 'DPA2'}, 'cutoff': 2000, 'mfi': 3000, 'raw_code': 'DPA1*02:01', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DPA2', 'high_res': None, 'split': 'DPA2'}, 'display_code': 'DPA2', 'raw_code': 'DPA2'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'DPA2', 'high_res': None, 'split': 'DPA2'}, 'issues': [], 'match_type': 'SPLIT', 'mfi': 3000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DP1054', 'high_res': None, 'split': 'DP1054'}, 'display_code': 'DP1054', 'raw_code': 'DP1054'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DQA1', 'high_res': None, 'split': 'DQA1'}, 'display_code': 'DQA1', 'raw_code': 'DQA1'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DQ1', 'high_res': None, 'split': 'DQ6'}, 'display_code': 'DQ6', 'raw_code': 'DQ6'}, 'is_frequent': True}], 'summary': None}], 'parsing_issues': [{'hla_code_or_group': 'A*01:06', 'message': 'The information about the serological equivalent of the allele is only assumed in our datasource so the conversion is not 100% reliable. Please check that the conversion is correct.', 'parsing_issue_detail': 'The information about the serological equivalent of the allele is only assumed in our datasource so the conversion is not 100% reliable. Please check that the conversion is correct.'}]}

A myslíte si, že tenhle obrovský text nějak pomůže? Všichni si tak myslí na začátku, ale pak narazí na "The two files are identical" a z toho momentu Váš osobní boj začíná.

Cílem tohoto issue je udělat ten test informativnější na chyby, aby ukazoval určitý důvod, proč padá. Příklad takové situace je tady #1235 .

@abragtim abragtim added the backend Backend related task/PR label Jun 27, 2023
@kubantjan
Copy link
Member

@abragtim to jak pises "priklad takove situace je tady" Neni za me moc srozumitelny, kde tady je priklad ty situace? Muzes to prosim lip vyspecifikovat?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend related task/PR
Projects
None yet
Development

No branches or pull requests

2 participants