Files
@ 7777a6f70fd5
Branch filter:
Location: rattail-project/rattail/tests/filemon/test_util.py - annotation
7777a6f70fd5
1.7 KiB
text/x-python
Remove deprecated `RattailConfig.getboolean()` method.
All calling code should be refactored, I believe..
All calling code should be refactored, I believe..
2c7d6c16e14f 00cfe2afce43 92c03f5d8db0 92c03f5d8db0 2c7d6c16e14f 00cfe2afce43 00cfe2afce43 2c7d6c16e14f 2c7d6c16e14f 85ab706736d2 00cfe2afce43 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 85ab706736d2 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 00cfe2afce43 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 00cfe2afce43 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 00cfe2afce43 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f 2c7d6c16e14f | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import Queue
from unittest import TestCase
from fixture import TempIO
from rattail.config import make_config
from rattail.filemon import util
from rattail.filemon.config import Profile
class TestQueueExisting(TestCase):
def setUp(self):
self.tmp = TempIO()
self.config = make_config([])
self.config.set(u'rattail.filemon', u'monitor', u'foo')
self.config.set(u'rattail.filemon', u'foo.dirs', self.tmp)
self.config.set(u'rattail.filemon', u'foo.actions', u'noop')
self.config.set(u'rattail.filemon', u'foo.action.noop.func', u'rattail.filemon.actions:noop')
self.profile = Profile(self.config, u'foo')
self.profile.queue = Queue.Queue()
def test_nothing_queued_if_no_files_exist(self):
util.queue_existing(self.profile, self.tmp)
self.assertTrue(self.profile.queue.empty())
def test_normal_files_are_queued_but_not_folders(self):
self.tmp.putfile(u'file', u'')
self.tmp.mkdir(u'folder')
util.queue_existing(self.profile, self.tmp)
self.assertEqual(self.profile.queue.qsize(), 1)
self.assertEqual(self.profile.queue.get_nowait(), self.tmp.join(u'file'))
self.assertTrue(self.profile.queue.empty())
def test_if_profile_watches_locks_then_normal_files_are_queued_but_not_lock_files(self):
self.profile.watch_locks = True
self.tmp.putfile(u'file1.lock', u'')
self.tmp.putfile(u'file2', u'')
util.queue_existing(self.profile, self.tmp)
self.assertEqual(self.profile.queue.qsize(), 1)
self.assertEqual(self.profile.queue.get_nowait(), self.tmp.join(u'file2'))
self.assertTrue(self.profile.queue.empty())
|