Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)