Esempio n. 1
0
 def test_get_all_cache(self, mock_cache):
     mock_cache.get.return_value = None
     expected_calls = [mock.call.get(waffle.FLAGS_ALL_CACHE_KEY),
                       mock.call.add(waffle.FLAGS_ALL_CACHE_KEY, mock.ANY)]
     Flag.objects.create(name='myflag')
     Flag.objects.create(name='myotherflag')
     assert len(waffle.get_all_flag_names()) == 2
     mock_cache.assert_has_calls(expected_calls)
Esempio n. 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')
Esempio n. 3
0
 def test_get_all_add(self):
     Flag.objects.create(name='myflag')
     assert len(waffle.get_all_flag_names()) == 1
     Flag.objects.create(name='myotherflag')
     assert len(waffle.get_all_flag_names()) == 2