self.assertRaises(events.NoEventsError, events.get_actions_for_event, 'foo') mock_getalleventmappings.return_value = TEST_EVENT_MAPPINGS self.assertEqual(events.get_actions_for_event('event2'), ['action3', 'action4']) def test_get_all_event_action_mappings_existing(self): """Tests get_all_event_action_mappings when they're in memcache.""" memcache.set(key='event_action_mappings', value=TEST_EVENT_MAPPINGS) self.assertDictEqual(events.get_all_event_action_mappings(), TEST_EVENT_MAPPINGS) def test_get_all_event_action_mappings_no_existing(self): """Tests get_all_event_action_mappings when they're not in memcache.""" core_event = event_models.CoreEvent.create('event1') core_event.actions = ['action1', 'action2'] core_event.put() custom_event = event_models.CustomEvent.create('event2') custom_event.model = 'Device' custom_event.actions = ['action3', 'action4'] custom_event.put() reminder_event = event_models.ReminderEvent.create(0) reminder_event.actions = ['action5', 'action6'] self.assertDictEqual(events.get_all_event_action_mappings(), TEST_EVENT_MAPPINGS) if __name__ == '__main__': loanertest.main()
def main(): loanertest.main()