Beispiel #1
0
 def test_get_all_cache(self, mock_cache):
     mock_cache.get.return_value = None
     expected_calls = [mock.call.get(waffle.SWITCHES_ALL_CACHE_KEY),
                       mock.call.add(waffle.SWITCHES_ALL_CACHE_KEY, mock.ANY)]
     Switch.objects.create(name='myswitch')
     Switch.objects.create(name='myotherswitch')
     assert len(waffle.get_all_switch_tuples()) == 2
     mock_cache.assert_has_calls(expected_calls)
Beispiel #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')
Beispiel #3
0
 def test_get_all_add(self):
     Switch.objects.create(name='myswitch')
     assert len(waffle.get_all_switch_tuples()) == 1
     Switch.objects.create(name='myotherswitch')
     assert len(waffle.get_all_switch_tuples()) == 2