Example #1
0
 def test_flag_binary(self, _mock):
     _mock.return_value = '{"metadata":{"contains_binary_extension": 1, ' '"contains_binary_content": 0}}'
     tasks.flag_binary([self.addon.pk])
     eq_(Addon.objects.get(pk=self.addon.pk).binary, True)
     _mock.return_value = '{"metadata":{"contains_binary_extension": 0, ' '"contains_binary_content": 1}}'
     tasks.flag_binary([self.addon.pk])
     eq_(Addon.objects.get(pk=self.addon.pk).binary, True)
Example #2
0
 def test_flag_binary(self, _mock):
     _mock.return_value = ('{"metadata":{"contains_binary_extension": 1, '
                           '"contains_binary_content": 0}}')
     tasks.flag_binary([self.addon.pk])
     eq_(Addon.objects.get(pk=self.addon.pk).binary, True)
     _mock.return_value = ('{"metadata":{"contains_binary_extension": 0, '
                           '"contains_binary_content": 1}}')
     tasks.flag_binary([self.addon.pk])
     eq_(Addon.objects.get(pk=self.addon.pk).binary, True)
Example #3
0
 def test_flag_error(self, _mock):
     _mock.side_effect = RuntimeError()
     tasks.flag_binary([self.addon.pk])
     eq_(Addon.objects.get(pk=self.addon.pk).binary, False)
Example #4
0
 def test_flag_error(self, _mock):
     _mock.side_effect = RuntimeError()
     tasks.flag_binary([self.addon.pk])
     eq_(Addon.objects.get(pk=self.addon.pk).binary, False)
Example #5
0
 def test_flag_not_binary(self, _mock):
     _mock.return_value = '{"metadata":{"contains_binary_extension": 0}}'
     flag_binary([self.addon.pk])
     eq_(Addon.objects.get(pk=self.addon.pk).binary, False)
Example #6
0
 def test_flag_not_binary(self, _mock):
     _mock.return_value = '{"metadata":{"contains_binary_extension": 0}}'
     tasks.flag_binary([self.addon.pk])
     eq_(Addon.objects.get(pk=self.addon.pk).binary, False)