#NEWLINE# def test_questions_by_locale( self ) : #NEWLINE# #INDENT# 'Test locale filtering of questions API call.' #NEWLINE# q = QuestionFactory ( locale = 'en-US' ) #NEWLINE# a = AnswerFactory ( question = q ) #NEWLINE# q . solution = a #NEWLINE# q . save ( ) #NEWLINE# q = QuestionFactory ( locale = 'en-US' ) #NEWLINE# AnswerFactory ( question = q ) #NEWLINE# QuestionFactory ( locale = 'en-US' ) #NEWLINE# QuestionFactory ( locale = 'pt-BR' ) #NEWLINE# r = self . _get_api_result ( 'api.kpi.questions' ) #NEWLINE# eq_ ( r [ 'objects' ] [ 0 ] [ 'solved' ] , 1 ) #NEWLINE# eq_ ( r [ 'objects' ] [ 0 ] [ 'responded_24' ] , 2 ) #NEWLINE# eq_ ( r [ 'objects' ] [ 0 ] [ 'responded_72' ] , 2 ) #NEWLINE# eq_ ( r [ 'objects' ] [ 0 ] [ 'questions' ] , 4 ) #NEWLINE# r = self . _get_api_result ( 'api.kpi.questions' , locale = 'en-US' ) #NEWLINE# eq_ ( r [ 'objects' ] [ 0 ] [ 'solved' ] , 1 ) #NEWLINE# eq_ ( r [ 'objects' ] [ 0 ] [ 'responded_24' ] , 2 ) #NEWLINE# eq_ ( r [ 'objects' ] [ 0 ] [ 'responded_72' ] , 2 ) #NEWLINE# eq_ ( r [ 'objects' ] [ 0 ] [ 'questions' ] , 3 ) #NEWLINE# r = self . _get_api_result ( 'api.kpi.questions' , locale = 'pt-BR' ) #NEWLINE# eq_ ( r [ 'objects' ] [ 0 ] [ 'questions' ] , 1 ) #NEWLINE# assert ( 'solved' not in r [ 'objects' ] [ 0 ] ) #NEWLINE# assert ( 'responded_24' not in r [ 'objects' ] [ 0 ] ) #NEWLINE# assert ( 'responded_72' not in r [ 'objects' ] [ 0 ] )