def test_simple(self, mock_set_cache):
        default_manager.register("foo")
        option = Option.objects.create(key="foo", value="bar")
        sync_options(cutoff=60)

        assert mock_set_cache.called
        mock_set_cache.reset_mock()

        option.update(last_updated=option.last_updated - timedelta(days=1))

        sync_options(cutoff=60)

        assert not mock_set_cache.called
Exemple #2
0
    def test_simple(self, mock_update_cached_value):
        option = Option.objects.create(
            key='foo',
            value='bar',
        )
        sync_options(cutoff=60)

        mock_update_cached_value.assert_called_once_with(key='foo', value='bar')

        mock_update_cached_value.reset_mock()

        option.update(last_updated=option.last_updated - timedelta(days=1))

        sync_options(cutoff=60)

        assert not mock_update_cached_value.called
Exemple #3
0
    def test_simple(self, mock_set_cache):
        default_manager.register('foo')
        option = Option.objects.create(
            key='foo',
            value='bar',
        )
        sync_options(cutoff=60)

        assert mock_set_cache.called
        mock_set_cache.reset_mock()

        option.update(last_updated=option.last_updated - timedelta(days=1))

        sync_options(cutoff=60)

        assert not mock_set_cache.called
Exemple #4
0
    def test_simple(self, mock_update_cached_value):
        option = Option.objects.create(
            key='foo',
            value='bar',
        )
        sync_options(cutoff=60)

        mock_update_cached_value.assert_called_once_with(key='foo',
                                                         value='bar')

        mock_update_cached_value.reset_mock()

        option.update(last_updated=option.last_updated - timedelta(days=1))

        sync_options(cutoff=60)

        assert not mock_update_cached_value.called
Exemple #5
0
    def test_simple(self, mock_update_cached_value):
        default_manager.register('foo')
        option = Option.objects.create(
            key='foo',
            value='bar',
        )
        sync_options(cutoff=60)

        assert mock_update_cached_value.called

        mock_update_cached_value.reset_mock()

        option.update(last_updated=option.last_updated - timedelta(days=1))

        sync_options(cutoff=60)

        assert not mock_update_cached_value.called