def test_addScanForBuilders(self): # Test that addScanForBuilders generates NewBuildersScanner objects. self._stub_out_scheduleNextScanCycle() manager = BuilddManager() builder_names = set(builder.name for builder in getUtility(IBuilderSet)) scanners = manager.addScanForBuilders(builder_names) scanner_names = set(scanner.builder_name for scanner in scanners) self.assertEqual(builder_names, scanner_names)
def test_addScanForBuilders(self): # Test that addScanForBuilders generates NewBuildersScanner objects. self._stub_out_scheduleNextScanCycle() manager = BuilddManager() builder_names = set( builder.name for builder in getUtility(IBuilderSet)) scanners = manager.addScanForBuilders(builder_names) scanner_names = set(scanner.builder_name for scanner in scanners) self.assertEqual(builder_names, scanner_names)
def test_startService_adds_NewBuildersScanner(self): # When startService is called, the manager will start up a # NewBuildersScanner object. self._stub_out_scheduleNextScanCycle() clock = task.Clock() manager = BuilddManager(clock=clock) # Replace scan() with FakeMethod so we can see if it was called. manager.new_builders_scanner.scan = FakeMethod() manager.startService() advance = NewBuildersScanner.SCAN_INTERVAL + 1 clock.advance(advance) self.assertNotEqual(0, manager.new_builders_scanner.scan.call_count)
def test_startService_adds_NewBuildersScanner(self): # When startService is called, the manager will start up a # NewBuildersScanner object. self._stub_out_scheduleNextScanCycle() clock = task.Clock() manager = BuilddManager(clock=clock) # Replace scan() with FakeMethod so we can see if it was called. manager.new_builders_scanner.scan = FakeMethod() manager.startService() advance = NewBuildersScanner.SCAN_INTERVAL + 1 clock.advance(advance) self.assertNotEqual(0, manager.new_builders_scanner.scan.call_count)
def _getScanner(self, clock=None): nbs = NewBuildersScanner( manager=BuilddManager(builder_factory=BuilderFactory()), clock=clock) nbs.checkForNewBuilders() return nbs