#NEWLINE# def testVerifyHuman( self ) : #NEWLINE# #INDENT# experiment = Experiment ( name = 'experiment' ) #NEWLINE# experiment . save ( ) #NEWLINE# experiment . state = Experiment . ENABLED_STATE #NEWLINE# experiment . save ( ) #NEWLINE# other_experiment = Experiment ( name = 'other_experiment' ) #NEWLINE# other_experiment . save ( ) #NEWLINE# other_experiment . state = Experiment . ENABLED_STATE #NEWLINE# other_experiment . save ( ) #NEWLINE# self . client = Client ( ) #NEWLINE# original_participants_count = Participant . objects . all ( ) . count ( ) #NEWLINE# original_anonymous_visitors_count = AnonymousVisitor . objects . all ( ) . count ( ) #NEWLINE# experiment_url = reverse ( 'experiments.tests.views.experiment_test' , args = [ experiment . name ] ) #NEWLINE# response = self . client . get ( experiment_url ) #NEWLINE# self . assertEquals ( response . status_code , 200 ) #NEWLINE# self . assertEquals ( original_participants_count , Participant . objects . all ( ) . count ( ) ) #NEWLINE# self . assertEquals ( original_anonymous_visitors_count , AnonymousVisitor . objects . all ( ) . count ( ) ) #NEWLINE# confirm_human_url = reverse ( 'experiments.views.confirm_human' ) #NEWLINE# response = self . client . get ( confirm_human_url ) #NEWLINE# self . assertEquals ( response . status_code , 204 ) #NEWLINE# self . assertEquals ( 0 , len ( response . content ) ) #NEWLINE# self . assertEquals ( ( original_participants_count + 1 ) , Participant . objects . all ( ) . count ( ) ) #NEWLINE# self . assertEquals ( ( original_anonymous_visitors_count + 1 ) , AnonymousVisitor . objects . all ( ) . count ( ) ) #NEWLINE# response = self . client . get ( confirm_human_url ) #NEWLINE# self . assertEquals ( response . status_code , 204 ) #NEWLINE# self . assertEquals ( 0 , len ( response . content ) ) #NEWLINE# self . assertEquals ( ( original_participants_count + 1 ) , Participant . objects . all ( ) . count ( ) ) #NEWLINE# self . assertEquals ( ( original_anonymous_visitors_count + 1 ) , AnonymousVisitor . objects . all ( ) . count ( ) ) #NEWLINE# other_experiment_url = reverse ( 'experiments.tests.views.experiment_test' , args = [ other_experiment . name ] ) #NEWLINE# response = self . client . get ( other_experiment_url ) #NEWLINE# self . assertEquals ( response . status_code , 200 ) #NEWLINE# self . assertEquals ( ( original_participants_count + 2 ) , Participant . objects . all ( ) . count ( ) ) #NEWLINE# self . assertEquals ( ( original_anonymous_visitors_count + 1 ) , AnonymousVisitor . objects . all ( ) . count ( ) ) #NEWLINE# response = self . client . get ( confirm_human_url ) #NEWLINE# self . assertEquals ( response . status_code , 204 ) #NEWLINE# self . assertEquals ( 0 , len ( response . content ) ) #NEWLINE# self . assertEquals ( ( original_participants_count + 2 ) , Participant . objects . all ( ) . count ( ) ) #NEWLINE# self . assertEquals ( ( original_anonymous_visitors_count + 1 ) , AnonymousVisitor . objects . all ( ) . count ( ) )