Example #1
0
 def test_get_all_cache(self, mock_cache):
     mock_cache.get.return_value = None
     expected_calls = [mock.call.get(waffle.SAMPLES_ALL_CACHE_KEY),
                       mock.call.add(waffle.SAMPLES_ALL_CACHE_KEY, mock.ANY)]
     Sample.objects.create(name='mysample', percent='100.0')
     Sample.objects.create(name='myothersample', percent='100.0')
     assert len(waffle.get_all_sample_names()) == 2
     mock_cache.assert_has_calls(expected_calls)
Example #2
0
def wafflejs(request):
    flag_values = [(f, flag_is_active(request, f)) for f in get_all_flag_names()]
    sample_values = [(s, sample_is_active(s)) for s in get_all_sample_names()]

    return render_to_response('waffle/waffle.js', {'flags': flag_values,
                                                   'switches': get_all_switch_tuples(),
                                                   'samples': sample_values},
                              mimetype='application/x-javascript')
Example #3
0
 def test_get_all_add(self):
     Sample.objects.create(name='mysample', percent='100.0')
     assert len(waffle.get_all_sample_names()) == 1
     Sample.objects.create(name='myothersample', percent='100.0')
     assert len(waffle.get_all_sample_names()) == 2