@@ -863,3 +863,45 @@ def test__get_events(self):
863
863
864
864
self .assertEqual (expected_value , config .get_events ())
865
865
self .assertEqual (len (config .get_events ()), 2 )
866
+
867
+ def test__get_attributes_map (self ):
868
+ """ Test to check get_attributes_map returns the correct value """
869
+
870
+ actual_attributes_map = self .opt_config_service .get_attributes_map ()
871
+ expected_attributes = self .expected_config ['attributes' ]
872
+
873
+ expected_attributes_map = {}
874
+
875
+ for expected_attribute in expected_attributes :
876
+ optly_attribute = optimizely_config .OptimizelyAttribute (
877
+ expected_attribute ['id' ], expected_attribute ['key' ]
878
+ )
879
+ expected_attributes_map [expected_attribute ['key' ]] = optly_attribute
880
+
881
+ for attribute in actual_attributes_map .values ():
882
+ self .assertIsInstance (attribute , optimizely_config .OptimizelyAttribute )
883
+
884
+ self .assertEqual (len (expected_attributes ), len (actual_attributes_map ))
885
+ self .assertEqual (self .to_dict (actual_attributes_map ), self .to_dict (expected_attributes_map ))
886
+
887
+ def test__get_events_map (self ):
888
+ """ Test to check that get_events_map returns the correct value """
889
+
890
+ actual_events_map = self .opt_config_service .get_events_map ()
891
+ expected_events = self .expected_config ['events' ]
892
+
893
+ expected_events_map = {}
894
+
895
+ for expected_event in expected_events :
896
+ optly_event = optimizely_config .OptimizelyEvent (
897
+ expected_event ['id' ],
898
+ expected_event ['key' ],
899
+ expected_event ['experimentIds' ]
900
+ )
901
+ expected_events_map [expected_event ['key' ]] = optly_event
902
+
903
+ for event in actual_events_map .values ():
904
+ self .assertIsInstance (event , optimizely_config .OptimizelyEvent )
905
+
906
+ self .assertEqual (len (expected_events ), len (actual_events_map ))
907
+ self .assertEqual (self .to_dict (actual_events_map ), self .to_dict (expected_events_map ))
0 commit comments