def test_move_not_disabled_files(self, unhide_mock): with amo.tests.copy_file('apps/files/fixtures/files/jetpack.xpi', self.file_.guarded_file_path): cron.unhide_disabled_files() assert unhide_mock.called # Not a unicode string for the path. with override_settings(GUARDED_ADDONS_PATH='/tmp/guarded-addons'): with self.assertRaises(UnicodeDecodeError): # If the parameter to "os.walk" (called by # amo.utils.walkfiles) isn't a unicode string, it'll return # ascii encoded paths, which will break the File query with # the filename, raising the exception. cron.unhide_disabled_files()
def test_leave_disabled_files(self, os_mock): self.addon.update(status=amo.STATUS_DISABLED) cron.unhide_disabled_files() assert not os_mock.path.exists.called self.addon.update(status=amo.STATUS_LITE) self.file_.update(status=amo.STATUS_DISABLED) cron.unhide_disabled_files() assert not os_mock.path.exists.called self.addon.update(disabled_by_user=True) self.file_.update(status=amo.STATUS_LITE) cron.unhide_disabled_files() assert not os_mock.path.exists.called