def test_categorize_metrics(self):
        k = {
            'return_value.metric_slugs.return_value': ['foo', 'bar', 'baz'],
            'return_value._category_slugs.return_value': ['foo', 'bar'],
        }
        with patch('redis_metrics.forms.R', **k) as mock_R:
            data = {'category_name': 'Foo', 'metrics': ['foo', 'bar']}
            form = MetricCategoryForm(data)
            self.assertTrue(form.is_valid())
            form.categorize_metrics()
            # This is what should happen in the form when POSTing
            mock_R.assert_has_calls([
                # happens in __init__
                call(),
                call().metric_slugs(),

                # happens in categorize_metrics
                call().reset_category('Foo', ['foo', 'bar'])
            ])
Delete the currently selected filter.
dataset/ETHPy150Open bradmontgomery/django-redis-metrics/redis_metrics/tests/test_forms.py/TestMetricCategoryForm.test_categorize_metrics--crossover with--dataset/ETHPy150Open enthought/traitsui/traitsui/qt4/table_editor.py/TableFilterEditor._remove_button_fired