@@ -37,6 +37,7 @@ class EventBuilderTest(base.BaseTest):
3737 def setUp (self , * args , ** kwargs ):
3838 base .BaseTest .setUp (self , 'config_dict_with_multiple_experiments' )
3939 self .event_builder = self .optimizely .event_builder
40+ self .maxDiff = None
4041
4142 def _validate_event_object (self , event_obj , expected_url , expected_params , expected_verb , expected_headers ):
4243 """ Helper method to validate properties of the event object. """
@@ -86,7 +87,6 @@ def test_create_impression_event(self):
8687 'enrich_decisions' : True ,
8788 'anonymize_ip' : False ,
8889 'revision' : '42' ,
89- 'region' : 'US' ,
9090 }
9191
9292 with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
@@ -142,7 +142,6 @@ def test_create_impression_event__with_attributes(self):
142142 'enrich_decisions' : True ,
143143 'anonymize_ip' : False ,
144144 'revision' : '42' ,
145- 'region' : 'US' ,
146145 }
147146
148147 with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
@@ -196,7 +195,6 @@ def test_create_impression_event_when_attribute_is_not_in_datafile(self):
196195 'enrich_decisions' : True ,
197196 'anonymize_ip' : False ,
198197 'revision' : '42' ,
199- 'region' : 'US' ,
200198 }
201199
202200 with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
@@ -207,8 +205,7 @@ def test_create_impression_event_when_attribute_is_not_in_datafile(self):
207205 self .project_config .get_experiment_from_key ('test_experiment' ),
208206 '111129' ,
209207 'test_user' ,
210- {'do_you_know_me' : 'test_value' },
211- 'US'
208+ {'do_you_know_me' : 'test_value' }
212209 )
213210 self ._validate_event_object (
214211 event_obj ,
@@ -254,7 +251,6 @@ def test_create_impression_event_calls_is_attribute_valid(self):
254251 'enrich_decisions' : True ,
255252 'anonymize_ip' : False ,
256253 'revision' : '42' ,
257- 'region' : 'US' ,
258254 }
259255
260256 def side_effect (* args , ** kwargs ):
@@ -280,8 +276,7 @@ def side_effect(*args, **kwargs):
280276 self .project_config .get_experiment_from_key ('test_experiment' ),
281277 '111129' ,
282278 'test_user' ,
283- attributes ,
284- 'US' ,
279+ attributes
285280 )
286281
287282 self ._validate_event_object (
@@ -334,7 +329,6 @@ def test_create_impression_event__with_user_agent_when_bot_filtering_is_enabled(
334329 'enrich_decisions' : True ,
335330 'anonymize_ip' : False ,
336331 'revision' : '42' ,
337- 'region' : 'US' ,
338332 }
339333
340334 with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
@@ -347,8 +341,7 @@ def test_create_impression_event__with_user_agent_when_bot_filtering_is_enabled(
347341 self .project_config .get_experiment_from_key ('test_experiment' ),
348342 '111129' ,
349343 'test_user' ,
350- {'$opt_user_agent' : 'Edge' },
351- 'US'
344+ {'$opt_user_agent' : 'Edge' }
352345 )
353346
354347 self ._validate_event_object (
@@ -400,7 +393,6 @@ def test_create_impression_event__with_empty_attributes_when_bot_filtering_is_en
400393 'enrich_decisions' : True ,
401394 'anonymize_ip' : False ,
402395 'revision' : '42' ,
403- 'region' : 'US' ,
404396 }
405397
406398 with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
@@ -413,8 +405,7 @@ def test_create_impression_event__with_empty_attributes_when_bot_filtering_is_en
413405 self .project_config .get_experiment_from_key ('test_experiment' ),
414406 '111129' ,
415407 'test_user' ,
416- None ,
417- 'US'
408+ None
418409 )
419410
420411 self ._validate_event_object (
@@ -472,7 +463,6 @@ def test_create_impression_event__with_user_agent_when_bot_filtering_is_disabled
472463 'enrich_decisions' : True ,
473464 'anonymize_ip' : False ,
474465 'revision' : '42' ,
475- 'region' : 'US' ,
476466 }
477467
478468 with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
@@ -485,8 +475,7 @@ def test_create_impression_event__with_user_agent_when_bot_filtering_is_disabled
485475 self .project_config .get_experiment_from_key ('test_experiment' ),
486476 '111129' ,
487477 'test_user' ,
488- {'$opt_user_agent' : 'Chrome' },
489- 'US'
478+ {'$opt_user_agent' : 'Chrome' }
490479 )
491480
492481 self ._validate_event_object (
@@ -527,14 +516,13 @@ def test_create_conversion_event(self):
527516 'enrich_decisions' : True ,
528517 'anonymize_ip' : False ,
529518 'revision' : '42' ,
530- 'region' : 'US' ,
531519 }
532520
533521 with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
534522 'uuid.uuid4' , return_value = 'a68cf1ad-0393-4e18-af87-efe8f01a7c9c'
535523 ):
536524 event_obj = self .event_builder .create_conversion_event (
537- self .project_config , 'test_event' , 'test_user' , None , None , 'US'
525+ self .project_config , 'test_event' , 'test_user' , None , None
538526 )
539527 self ._validate_event_object (
540528 event_obj ,
@@ -576,14 +564,13 @@ def test_create_conversion_event__with_attributes(self):
576564 'enrich_decisions' : True ,
577565 'anonymize_ip' : False ,
578566 'revision' : '42' ,
579- 'region' : 'US' ,
580567 }
581568
582569 with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
583570 'uuid.uuid4' , return_value = 'a68cf1ad-0393-4e18-af87-efe8f01a7c9c'
584571 ):
585572 event_obj = self .event_builder .create_conversion_event (
586- self .project_config , 'test_event' , 'test_user' , {'test_attribute' : 'test_value' }, None , 'US'
573+ self .project_config , 'test_event' , 'test_user' , {'test_attribute' : 'test_value' }, None
587574 )
588575 self ._validate_event_object (
589576 event_obj ,
@@ -632,7 +619,6 @@ def test_create_conversion_event__with_user_agent_when_bot_filtering_is_enabled(
632619 'enrich_decisions' : True ,
633620 'anonymize_ip' : False ,
634621 'revision' : '42' ,
635- 'region' : 'US' ,
636622 }
637623
638624 with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
@@ -641,7 +627,7 @@ def test_create_conversion_event__with_user_agent_when_bot_filtering_is_enabled(
641627 'optimizely.project_config.ProjectConfig.get_bot_filtering_value' , return_value = True ,
642628 ):
643629 event_obj = self .event_builder .create_conversion_event (
644- self .project_config , 'test_event' , 'test_user' , {'$opt_user_agent' : 'Edge' }, None , 'US'
630+ self .project_config , 'test_event' , 'test_user' , {'$opt_user_agent' : 'Edge' }, None
645631 )
646632
647633 self ._validate_event_object (
@@ -696,7 +682,6 @@ def test_create_conversion_event__with_user_agent_when_bot_filtering_is_disabled
696682 'enrich_decisions' : True ,
697683 'anonymize_ip' : False ,
698684 'revision' : '42' ,
699- 'region' : 'US' ,
700685 }
701686
702687 with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
@@ -705,7 +690,7 @@ def test_create_conversion_event__with_user_agent_when_bot_filtering_is_disabled
705690 'optimizely.project_config.ProjectConfig.get_bot_filtering_value' , return_value = False ,
706691 ):
707692 event_obj = self .event_builder .create_conversion_event (
708- self .project_config , 'test_event' , 'test_user' , {'$opt_user_agent' : 'Chrome' }, None , 'US'
693+ self .project_config , 'test_event' , 'test_user' , {'$opt_user_agent' : 'Chrome' }, None
709694 )
710695
711696 self ._validate_event_object (
@@ -751,7 +736,6 @@ def test_create_conversion_event__with_event_tags(self):
751736 'enrich_decisions' : True ,
752737 'anonymize_ip' : False ,
753738 'revision' : '42' ,
754- 'region' : 'US' ,
755739 }
756740
757741 with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
@@ -762,8 +746,7 @@ def test_create_conversion_event__with_event_tags(self):
762746 'test_event' ,
763747 'test_user' ,
764748 {'test_attribute' : 'test_value' },
765- {'revenue' : 4200 , 'value' : 1.234 , 'non-revenue' : 'abc' },
766- 'US'
749+ {'revenue' : 4200 , 'value' : 1.234 , 'non-revenue' : 'abc' }
767750 )
768751 self ._validate_event_object (
769752 event_obj ,
@@ -806,7 +789,6 @@ def test_create_conversion_event__with_invalid_event_tags(self):
806789 'enrich_decisions' : True ,
807790 'anonymize_ip' : False ,
808791 'revision' : '42' ,
809- 'region' : 'US' ,
810792 }
811793
812794 with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
@@ -817,8 +799,7 @@ def test_create_conversion_event__with_invalid_event_tags(self):
817799 'test_event' ,
818800 'test_user' ,
819801 {'test_attribute' : 'test_value' },
820- {'revenue' : '4200' , 'value' : True , 'non-revenue' : 'abc' },
821- 'US'
802+ {'revenue' : '4200' , 'value' : True , 'non-revenue' : 'abc' }
822803 )
823804 self ._validate_event_object (
824805 event_obj ,
@@ -863,7 +844,6 @@ def test_create_conversion_event__when_event_is_used_in_multiple_experiments(sel
863844 'enrich_decisions' : True ,
864845 'anonymize_ip' : False ,
865846 'revision' : '42' ,
866- 'region' : 'US' ,
867847 }
868848
869849 with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
@@ -874,8 +854,7 @@ def test_create_conversion_event__when_event_is_used_in_multiple_experiments(sel
874854 'test_event' ,
875855 'test_user' ,
876856 {'test_attribute' : 'test_value' },
877- {'revenue' : 4200 , 'value' : 1.234 , 'non-revenue' : 'abc' },
878- 'US'
857+ {'revenue' : 4200 , 'value' : 1.234 , 'non-revenue' : 'abc' }
879858 )
880859 self ._validate_event_object (
881860 event_obj ,
0 commit comments