Exemplo n.º 1
0
    def test_calls_view_if_flag_active(self):
        """Test that the wrapped view is caleld if the feature flag is active."""
        FeatureFlagFactory(code='test-feature-flag', is_active=True)

        mock = Mock()
        feature_flagged_view('test-feature-flag')(mock)()
        mock.assert_called_once()
Exemplo n.º 2
0
    def test_raises_404_is_flag_inactive(self):
        """Test that an Http404 is raised if the feature flag is inactive."""
        FeatureFlagFactory(code='test-feature-flag', is_active=False)

        mock = Mock()
        with pytest.raises(Http404):
            feature_flagged_view('test-feature-flag')(mock)()
        mock.assert_not_called()
Exemplo n.º 3
0
 def test_raises_404_if_flag_does_not_exist(self):
     """Test that an Http404 is raised if the feature flag does not exist."""
     mock = Mock()
     with pytest.raises(Http404):
         feature_flagged_view('test-feature-flag')(mock)()
     mock.assert_not_called()