<s> """<STR_LIT>""" <EOL> from grr . lib import server_plugins <EOL> from grr . gui . api_plugins import tests as tests_lib <EOL> import json <EOL> from grr . gui import api_test_lib <EOL> from grr . gui import http_api <EOL> from grr . lib import flags <EOL> from grr . lib import startup <EOL> def GroupRegressionTestsByHandler ( ) : <EOL> result = { } <EOL> for cls in api_test_lib . ApiCallHandlerRegressionTest . classes . values ( ) : <EOL> if getattr ( cls , "<STR_LIT>" , None ) : <EOL> result . setdefault ( cls . handler , [ ] ) . append ( cls ) <EOL> return result <EOL> def main ( unused_argv ) : <EOL> sample_data = { } <EOL> tests = GroupRegressionTestsByHandler ( ) <EOL> for handler , test_classes in tests . items ( ) : <EOL> for test_class in sorted ( test_classes , key = lambda cls : cls . __name__ ) : <EOL> if flags . FLAGS . tests and test_class . __name__ not in flags . FLAGS . tests : <EOL> continue <EOL> test_instance = test_class ( ) <EOL> startup . TestInit ( ) <EOL> try : <EOL> test_instance . setUp ( ) <EOL> test_instance . Run ( ) <EOL> sample_data . setdefault ( handler , [ ] ) . extend ( test_instance . checks ) <EOL> finally : <EOL> try : <EOL> test_instance . tearDown ( ) <EOL> except Exception : <EOL> pass <EOL> encoded_sample_data = json . dumps ( <EOL> sample_data , indent = <NUM_LIT:2> , sort_keys = True , separators = ( "<STR_LIT:U+002C>" , "<STR_LIT>" ) , <EOL> cls = http_api . JSONEncoderWithRDFPrimitivesSupport ) <EOL> print encoded_sample_data <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> flags . StartMain ( main ) </s>
