def test_flag_binary(self, _mock): _mock.return_value = ('{"metadata":{"contains_binary_extension": 1, ' '"contains_binary_content": 0}}') tasks.flag_binary([self.addon.pk]) assert Addon.objects.get(pk=self.addon.pk).binary _mock.return_value = ('{"metadata":{"contains_binary_extension": 0, ' '"contains_binary_content": 1}}') tasks.flag_binary([self.addon.pk]) assert Addon.objects.get(pk=self.addon.pk).binary
def test_flag_error(self, _mock): _mock.side_effect = RuntimeError() tasks.flag_binary([self.addon.pk]) assert not Addon.objects.get(pk=self.addon.pk).binary