#NEWLINE# @ override_settings ( TESTS_SHOULD_USE_SQL_BACKEND = True ) #NEWLINE# def test_case_pillow_sql( self ) : #NEWLINE# #INDENT# consumer = get_test_kafka_consumer ( topics . CASE_SQL ) #NEWLINE# kafka_seq = consumer . offsets ( ) [ 'fetch' ] [ ( topics . CASE_SQL , 0 ) ] #NEWLINE# case_id = uuid . uuid4 ( ) . hex #NEWLINE# case_name = 'case-name-{}' . format ( uuid . uuid4 ( ) . hex ) #NEWLINE# case = create_and_save_a_case ( self . domain , case_id , case_name ) #NEWLINE# message = consumer . next ( ) #NEWLINE# change_meta = change_meta_from_kafka_message ( message . value ) #NEWLINE# self . assertEqual ( case . case_id , change_meta . document_id ) #NEWLINE# self . assertEqual ( self . domain , change_meta . domain ) #NEWLINE# sql_pillow = get_sql_case_to_elasticsearch_pillow ( ) #NEWLINE# sql_pillow . process_changes ( since = kafka_seq , forever = False ) #NEWLINE# self . elasticsearch . indices . refresh ( self . pillow . es_index ) #NEWLINE# results = CaseES ( ) . run ( ) #NEWLINE# self . assertEqual ( 1 , results . total ) #NEWLINE# case_doc = results . hits [ 0 ] #NEWLINE# self . assertEqual ( self . domain , case_doc [ 'domain' ] ) #NEWLINE# self . assertEqual ( case_id , case_doc [ '_id' ] ) #NEWLINE# self . assertEqual ( case_name , case [ 'name' ] )