Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
Prev Previous commit
Next Next commit
[OASIS-7800] - Added test cases for attribute map and events map
  • Loading branch information
The-inside-man committed Jun 24, 2021
commit 5e479a06bf442040a3940c22597dc6892b14ed40
42 changes: 42 additions & 0 deletions tests/test_optimizely_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,3 +863,45 @@ 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))