#NEWLINE# def _assert_es_user_and_groups( test_case , es_client , user_id , group_ids = None , group_names = None ) : #NEWLINE# #INDENT# es_client . indices . refresh ( USER_INDEX ) #NEWLINE# es_user = es_client . get ( USER_INDEX , user_id ) #NEWLINE# user_doc = es_user [ '_source' ] #NEWLINE# if ( group_names is None ) : #NEWLINE# #INDENT# test_case . assertTrue ( ( '__group_ids' not in user_doc ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# test_case . assertEqual ( set ( user_doc [ '__group_ids' ] ) , set ( group_ids ) ) #NEWLINE# #UNINDENT# if ( group_names is None ) : #NEWLINE# #INDENT# test_case . assertTrue ( ( '__group_names' not in user_doc ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# test_case . assertEqual ( set ( user_doc [ '__group_names' ] ) , set ( group_names ) )