@@ -37,6 +37,7 @@ class EventBuilderTest(base.BaseTest):
37
37
def setUp (self , * args , ** kwargs ):
38
38
base .BaseTest .setUp (self , 'config_dict_with_multiple_experiments' )
39
39
self .event_builder = self .optimizely .event_builder
40
+ self .maxDiff = None
40
41
41
42
def _validate_event_object (self , event_obj , expected_url , expected_params , expected_verb , expected_headers ):
42
43
""" Helper method to validate properties of the event object. """
@@ -86,7 +87,6 @@ def test_create_impression_event(self):
86
87
'enrich_decisions' : True ,
87
88
'anonymize_ip' : False ,
88
89
'revision' : '42' ,
89
- 'region' : 'US' ,
90
90
}
91
91
92
92
with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
@@ -142,7 +142,6 @@ def test_create_impression_event__with_attributes(self):
142
142
'enrich_decisions' : True ,
143
143
'anonymize_ip' : False ,
144
144
'revision' : '42' ,
145
- 'region' : 'US' ,
146
145
}
147
146
148
147
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):
196
195
'enrich_decisions' : True ,
197
196
'anonymize_ip' : False ,
198
197
'revision' : '42' ,
199
- 'region' : 'US' ,
200
198
}
201
199
202
200
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):
207
205
self .project_config .get_experiment_from_key ('test_experiment' ),
208
206
'111129' ,
209
207
'test_user' ,
210
- {'do_you_know_me' : 'test_value' },
211
- 'US'
208
+ {'do_you_know_me' : 'test_value' }
212
209
)
213
210
self ._validate_event_object (
214
211
event_obj ,
@@ -254,7 +251,6 @@ def test_create_impression_event_calls_is_attribute_valid(self):
254
251
'enrich_decisions' : True ,
255
252
'anonymize_ip' : False ,
256
253
'revision' : '42' ,
257
- 'region' : 'US' ,
258
254
}
259
255
260
256
def side_effect (* args , ** kwargs ):
@@ -280,8 +276,7 @@ def side_effect(*args, **kwargs):
280
276
self .project_config .get_experiment_from_key ('test_experiment' ),
281
277
'111129' ,
282
278
'test_user' ,
283
- attributes ,
284
- 'US' ,
279
+ attributes
285
280
)
286
281
287
282
self ._validate_event_object (
@@ -334,7 +329,6 @@ def test_create_impression_event__with_user_agent_when_bot_filtering_is_enabled(
334
329
'enrich_decisions' : True ,
335
330
'anonymize_ip' : False ,
336
331
'revision' : '42' ,
337
- 'region' : 'US' ,
338
332
}
339
333
340
334
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(
347
341
self .project_config .get_experiment_from_key ('test_experiment' ),
348
342
'111129' ,
349
343
'test_user' ,
350
- {'$opt_user_agent' : 'Edge' },
351
- 'US'
344
+ {'$opt_user_agent' : 'Edge' }
352
345
)
353
346
354
347
self ._validate_event_object (
@@ -400,7 +393,6 @@ def test_create_impression_event__with_empty_attributes_when_bot_filtering_is_en
400
393
'enrich_decisions' : True ,
401
394
'anonymize_ip' : False ,
402
395
'revision' : '42' ,
403
- 'region' : 'US' ,
404
396
}
405
397
406
398
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
413
405
self .project_config .get_experiment_from_key ('test_experiment' ),
414
406
'111129' ,
415
407
'test_user' ,
416
- None ,
417
- 'US'
408
+ None
418
409
)
419
410
420
411
self ._validate_event_object (
@@ -472,7 +463,6 @@ def test_create_impression_event__with_user_agent_when_bot_filtering_is_disabled
472
463
'enrich_decisions' : True ,
473
464
'anonymize_ip' : False ,
474
465
'revision' : '42' ,
475
- 'region' : 'US' ,
476
466
}
477
467
478
468
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
485
475
self .project_config .get_experiment_from_key ('test_experiment' ),
486
476
'111129' ,
487
477
'test_user' ,
488
- {'$opt_user_agent' : 'Chrome' },
489
- 'US'
478
+ {'$opt_user_agent' : 'Chrome' }
490
479
)
491
480
492
481
self ._validate_event_object (
@@ -527,14 +516,13 @@ def test_create_conversion_event(self):
527
516
'enrich_decisions' : True ,
528
517
'anonymize_ip' : False ,
529
518
'revision' : '42' ,
530
- 'region' : 'US' ,
531
519
}
532
520
533
521
with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
534
522
'uuid.uuid4' , return_value = 'a68cf1ad-0393-4e18-af87-efe8f01a7c9c'
535
523
):
536
524
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
538
526
)
539
527
self ._validate_event_object (
540
528
event_obj ,
@@ -576,14 +564,13 @@ def test_create_conversion_event__with_attributes(self):
576
564
'enrich_decisions' : True ,
577
565
'anonymize_ip' : False ,
578
566
'revision' : '42' ,
579
- 'region' : 'US' ,
580
567
}
581
568
582
569
with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
583
570
'uuid.uuid4' , return_value = 'a68cf1ad-0393-4e18-af87-efe8f01a7c9c'
584
571
):
585
572
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
587
574
)
588
575
self ._validate_event_object (
589
576
event_obj ,
@@ -632,7 +619,6 @@ def test_create_conversion_event__with_user_agent_when_bot_filtering_is_enabled(
632
619
'enrich_decisions' : True ,
633
620
'anonymize_ip' : False ,
634
621
'revision' : '42' ,
635
- 'region' : 'US' ,
636
622
}
637
623
638
624
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(
641
627
'optimizely.project_config.ProjectConfig.get_bot_filtering_value' , return_value = True ,
642
628
):
643
629
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
645
631
)
646
632
647
633
self ._validate_event_object (
@@ -696,7 +682,6 @@ def test_create_conversion_event__with_user_agent_when_bot_filtering_is_disabled
696
682
'enrich_decisions' : True ,
697
683
'anonymize_ip' : False ,
698
684
'revision' : '42' ,
699
- 'region' : 'US' ,
700
685
}
701
686
702
687
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
705
690
'optimizely.project_config.ProjectConfig.get_bot_filtering_value' , return_value = False ,
706
691
):
707
692
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
709
694
)
710
695
711
696
self ._validate_event_object (
@@ -751,7 +736,6 @@ def test_create_conversion_event__with_event_tags(self):
751
736
'enrich_decisions' : True ,
752
737
'anonymize_ip' : False ,
753
738
'revision' : '42' ,
754
- 'region' : 'US' ,
755
739
}
756
740
757
741
with mock .patch ('time.time' , return_value = 42.123 ), mock .patch (
@@ -762,8 +746,7 @@ def test_create_conversion_event__with_event_tags(self):
762
746
'test_event' ,
763
747
'test_user' ,
764
748
{'test_attribute' : 'test_value' },
765
- {'revenue' : 4200 , 'value' : 1.234 , 'non-revenue' : 'abc' },
766
- 'US'
749
+ {'revenue' : 4200 , 'value' : 1.234 , 'non-revenue' : 'abc' }
767
750
)
768
751
self ._validate_event_object (
769
752
event_obj ,
@@ -806,7 +789,6 @@ def test_create_conversion_event__with_invalid_event_tags(self):
806
789
'enrich_decisions' : True ,
807
790
'anonymize_ip' : False ,
808
791
'revision' : '42' ,
809
- 'region' : 'US' ,
810
792
}
811
793
812
794
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):
817
799
'test_event' ,
818
800
'test_user' ,
819
801
{'test_attribute' : 'test_value' },
820
- {'revenue' : '4200' , 'value' : True , 'non-revenue' : 'abc' },
821
- 'US'
802
+ {'revenue' : '4200' , 'value' : True , 'non-revenue' : 'abc' }
822
803
)
823
804
self ._validate_event_object (
824
805
event_obj ,
@@ -863,7 +844,6 @@ def test_create_conversion_event__when_event_is_used_in_multiple_experiments(sel
863
844
'enrich_decisions' : True ,
864
845
'anonymize_ip' : False ,
865
846
'revision' : '42' ,
866
- 'region' : 'US' ,
867
847
}
868
848
869
849
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
874
854
'test_event' ,
875
855
'test_user' ,
876
856
{'test_attribute' : 'test_value' },
877
- {'revenue' : 4200 , 'value' : 1.234 , 'non-revenue' : 'abc' },
878
- 'US'
857
+ {'revenue' : 4200 , 'value' : 1.234 , 'non-revenue' : 'abc' }
879
858
)
880
859
self ._validate_event_object (
881
860
event_obj ,
0 commit comments