Esempio n. 1
0
    def test_sample_did_not_exist(self):
        assert not Sample.objects.filter(name='foo').exists()

        with override_sample('foo', active=True):
            assert waffle.sample_is_active('foo')

        with override_sample('foo', active=False):
            assert not waffle.sample_is_active('foo')

        assert not Sample.objects.filter(name='foo').exists()
Esempio n. 2
0
    def test_sample_did_not_exist(self):
        assert not Sample.objects.filter(name="foo").exists()

        with override_sample("foo", active=True):
            assert waffle.sample_is_active(req(), "foo")

        with override_sample("foo", active=False):
            assert not waffle.sample_is_active(req(), "foo")

        assert not Sample.objects.filter(name="foo").exists()
Esempio n. 3
0
    def test_sample_existed_and_was_50(self):
        Sample.objects.create(name="foo", percent="50.0")

        with override_sample("foo", active=True):
            assert waffle.sample_is_active(req(), "foo")

        with override_sample("foo", active=False):
            assert not waffle.sample_is_active("foo")

        self.assertEquals(Decimal("50.0"), Sample.objects.get(name="foo").percent)
Esempio n. 4
0
    def test_sample_existed_and_was_50(self):
        Sample.objects.create(name='foo', percent='50.0')

        with override_sample('foo', active=True):
            assert waffle.sample_is_active('foo')

        with override_sample('foo', active=False):
            assert not waffle.sample_is_active('foo')

        self.assertEquals(Decimal('50.0'),
                          Sample.objects.get(name='foo').percent)
Esempio n. 5
0
    def test_cache_is_flushed_by_testutils_even_in_transaction(self):
        Sample.objects.create(name='foo', percent='100.0')

        with transaction.atomic():
            with override_sample('foo', active=True):
                assert waffle.sample_is_active('foo')

            with override_sample('foo', active=False):
                assert not waffle.sample_is_active('foo')

        assert waffle.sample_is_active('foo')
Esempio n. 6
0
    def test_cache_is_flushed_by_testutils_even_in_transaction(self):
        Sample.objects.create(name='foo', percent='100.0')

        with transaction.atomic():
            with override_sample('foo', active=True):
                assert waffle.sample_is_active('foo')

            with override_sample('foo', active=False):
                assert not waffle.sample_is_active('foo')

        assert waffle.sample_is_active('foo')