def test_unregister(self):
        action_registry.register(some_action, 'My Label')
        action_registry.unregister(self.key3)

        self.assertIsNone(action_registry.get(self.key3))
        choices = sorted(action_registry.get_as_choices(), key=lambda x: x[1])
        self.assertEqual(choices,
                         [('dynamic_forms.actions.dynamic_form_send_email',
                           'Send via email'),
                          ('dynamic_forms.actions.dynamic_form_store_database',
                           'Store in database')])
    def test_unregister(self):
        action_registry.register(some_action, 'My Label')
        action_registry.unregister(self.key3)

        self.assertIsNone(action_registry.get(self.key3))
        choices = sorted(action_registry.get_as_choices(), key=lambda x: x[1])
        self.assertEqual(choices, [
            ('dynamic_forms.actions.dynamic_form_send_email',
                'Send via email'),
            ('dynamic_forms.actions.dynamic_form_store_database',
                'Store in database')
        ])
    def test_unregister(self):
        action_registry.register(some_action, "My Label")
        action_registry.unregister(self.key3)

        self.assertIsNone(action_registry.get(self.key3))
        self.assertEqual(
            action_registry.get_as_choices(),
            [
                ("dynamic_forms.actions.dynamic_form_send_email", "Send via email"),
                ("dynamic_forms.actions.dynamic_form_store_database", "Store in database"),
            ],
        )
Example #4
0
 def tearDown(self):
     TestAction.clear()
     action_registry.unregister('tests.test_views.TestAction')
     action_registry.unregister('tests.test_views.TestOldAction')
     action_registry.unregister('tests.test_views.TestAction2')
 def test_unregister_not_exists(self):
     action_registry.unregister('key-does-not-exist')
 def tearDown(self):
     TestAction.clear()
     action_registry.unregister('tests.test_views.TestAction')
     action_registry.unregister('tests.test_views.TestAction2')
 def test_unregister_not_exists(self):
     action_registry.unregister('key-does-not-exist')