Skip to content

Commit

Permalink
Removing unused get_events_map and get_Attributes_map along with test…
Browse files Browse the repository at this point in the history
…ing for those two functions. (#340)
  • Loading branch information
The-inside-man authored Jul 1, 2021
1 parent 7cc2bde commit b55582c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 76 deletions.
34 changes: 0 additions & 34 deletions optimizely/optimizely_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,37 +295,3 @@ def _get_features_map(self, experiments_id_map):
features_map[feature['key']] = optly_feature

return features_map

def get_attributes_map(self):
""" Gets attributes map for the project config.
Returns:
dict -- Attribute key, OptimizelyAttribute map
"""

attributes_map = {}

for attribute in self.attributes:
optly_attribute = OptimizelyAttribute(
attribute['id'], attribute['key']
)
attributes_map[attribute['key']] = optly_attribute

return attributes_map

def get_events_map(self):
""" Gets events map for the project config.
Returns:
dict -- Event key, OptimizelyEvent map
"""

events_map = {}

for event in self.events:
optly_event = OptimizelyEvent(
event['id'], event['key'], event.get('experimentIds', [])
)
events_map[event['key']] = optly_event

return events_map
42 changes: 0 additions & 42 deletions tests/test_optimizely_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,45 +863,3 @@ def test__get_events(self):

self.assertEqual(expected_value, config.get_events())
self.assertEqual(len(config.get_events()), 2)

def test__get_attributes_map(self):
""" Test to check get_attributes_map returns the correct value """

actual_attributes_map = self.opt_config_service.get_attributes_map()
expected_attributes = self.expected_config['attributes']

expected_attributes_map = {}

for expected_attribute in expected_attributes:
optly_attribute = optimizely_config.OptimizelyAttribute(
expected_attribute['id'], expected_attribute['key']
)
expected_attributes_map[expected_attribute['key']] = optly_attribute

for attribute in actual_attributes_map.values():
self.assertIsInstance(attribute, optimizely_config.OptimizelyAttribute)

self.assertEqual(len(expected_attributes), len(actual_attributes_map))
self.assertEqual(self.to_dict(actual_attributes_map), self.to_dict(expected_attributes_map))

def test__get_events_map(self):
""" Test to check that get_events_map returns the correct value """

actual_events_map = self.opt_config_service.get_events_map()
expected_events = self.expected_config['events']

expected_events_map = {}

for expected_event in expected_events:
optly_event = optimizely_config.OptimizelyEvent(
expected_event['id'],
expected_event['key'],
expected_event['experimentIds']
)
expected_events_map[expected_event['key']] = optly_event

for event in actual_events_map.values():
self.assertIsInstance(event, optimizely_config.OptimizelyEvent)

self.assertEqual(len(expected_events), len(actual_events_map))
self.assertEqual(self.to_dict(actual_events_map), self.to_dict(expected_events_map))

0 comments on commit b55582c

Please sign in to comment.