Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove get_events_map and get_attributes_map #340

Merged
merged 2 commits into from
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))