def testBadCreate(self): self.driver.add(InfoEvent(1, monitors.EventInfo( old_div(self.dir, "foo"), monitors.EventType.Create))) self.driver.add(InfoEvent(1, monitors.EventInfo( old_div(self.dir, "foo"), monitors.EventType.Create))) self.driver.run() self.assertErrors()
def testSimpleDeleteWithModify(self): self.driver.add(InfoEvent(1, monitors.EventInfo( old_div(self.dir, "foo"), monitors.EventType.Create))) self.driver.add(InfoEvent(1, monitors.EventInfo( old_div(self.dir, "foo"), monitors.EventType.Modify))) self.driver.add(InfoEvent(1, monitors.EventInfo( old_div(self.dir, "foo"), monitors.EventType.Delete))) self.driver.run()
def testDirectoryMethodsDirInfo(self): self.driver.add(DirInfoEvent(1, monitors.EventInfo( old_div(self.dir, "dir"), monitors.EventType.Create))) self.driver.add(DirInfoEvent(1, monitors.EventInfo( old_div(self.dir, "dir"), monitors.EventType.Modify))) self.driver.add(DirInfoEvent(1, monitors.EventInfo( old_div(self.dir, "dir"), monitors.EventType.Delete))) self.driver.run()
def testDirectoryMethodsInfo(self): self.driver.add(InfoEvent(1, monitors.EventInfo( self.dir / "foo", monitors.EventType.Create))) self.driver.add(InfoEvent(1, monitors.EventInfo( self.dir / "foo", monitors.EventType.Modify))) self.driver.add(InfoEvent(1, monitors.EventInfo( self.dir / "foo", monitors.EventType.Delete))) self.driver.run()
def testDirectoryInDirectory(self): self.driver.add( DirInfoEvent( 1, monitors.EventInfo(self.dir / "root" / "dir", monitors.EventType.Create))) self.driver.add( DirInfoEvent( 1, monitors.EventInfo(self.dir / "root" / "dir" / "dir", monitors.EventType.Create))) self.driver.run()
def testSimpleDelete(self): self.beforeMethod() self.driver.add( InfoEvent( 1, monitors.EventInfo(self.dir / "foo", monitors.EventType.Create))) self.driver.add( InfoEvent( 1, monitors.EventInfo(self.dir / "foo", monitors.EventType.Delete))) self.driver.run()
def testBadCreate(self): self.beforeMethod() self.driver.add( InfoEvent( 1, monitors.EventInfo(self.dir / "foo", monitors.EventType.Create))) self.driver.add( InfoEvent( 1, monitors.EventInfo(self.dir / "foo", monitors.EventType.Create))) self.driver.run() self.assertErrors()
def callback(self, monitorId, fileList): """ Callback required by FSEvents.FSEventStream. :Parameters: :return: No explicit return value. """ eventList = [] for fileEvent in fileList: info = monitors.EventInfo(fileEvent[0], fileEvent[1]) eventList.append(info) proxy = self.proxies[monitorId] try: self.log.info('Event notification on monitor id= %s', monitorId) self.log.debug(' ...notifications are: %s', str(eventList)) proxy.fsEventHappened(monitorId, eventList) except Exception, e: self.log.info('Callback to monitor id=' + monitorId + ' failed. Reason: ' + str(e))
def testWithSingleImport(self): f = self.dir / "root" / "file" self.client.files = {str(f): [str(f)]} self.driver.add(DirInfoEvent(0, monitors.EventInfo( self.dir / "root" / "file", monitors.EventType.Create))) self.driver.run() time.sleep(0.25)
def testBasicAdd(self): self.driver.add( DirInfoEvent( 1, monitors.EventInfo(self.dir / "root" / "dirtimeout", monitors.EventType.Create))) self.driver.run()
def testWithMultiImport(self): f1 = str(self.dir / "root" / "file1") f2 = str(self.dir / "root" / "file2") f3 = str(self.dir / "root" / "file3") f4 = str(self.dir / "root" / "file4") self.client.files = {f1: [f1, f2, f3, f4]} self.client.setDirImportWait(1) self.driver.add(DirInfoEvent(0.0, monitors.EventInfo( f1, monitors.EventType.Create))) self.driver.add(DirInfoEvent(100, monitors.EventInfo( f2, monitors.EventType.Create))) self.driver.add(DirInfoEvent(200, monitors.EventInfo( f3, monitors.EventType.Create))) self.driver.add(DirInfoEvent(300, monitors.EventInfo( f4, monitors.EventType.Create))) time.sleep(1) self.driver.run()
def testDirectoryDoesntExistOnDelete(self): self.beforeMethod() self.driver.add( DirInfoEvent( 1, monitors.EventInfo(self.dir / "dir", monitors.EventType.Delete))) self.driver.run() self.assertErrors()
def testDirectoryMethods(self): self.beforeMethod() self.driver.add( DirInfoEvent( 1, monitors.EventInfo(self.dir / "dir", monitors.EventType.Create))) self.driver.add( DirInfoEvent( 1, monitors.EventInfo(self.dir / "dir", monitors.EventType.Modify))) self.driver.add( DirInfoEvent( 1, monitors.EventInfo(self.dir / "dir", monitors.EventType.Delete))) self.driver.run()
def testDirectoryDoesntExistOnDelete(self): self.driver.add(DirInfoEvent(1, monitors.EventInfo( old_div(self.dir, "dir"), monitors.EventType.Delete))) self.driver.run() self.assertErrors()
def testBadFileId(self): # Could cause infinite loop with pytest.raises(omero.ApiUsageException): MockMonitor().fsEventHappened('', [monitors.EventInfo()])
def testBadFileId(self): # Could cause infinite loop self.assertRaises(omero.ApiUsageException, MockMonitor().fsEventHappened, '', [monitors.EventInfo()])
def testSimpleModify(self): self.driver.add(InfoEvent(1, monitors.EventInfo( self.dir / "foo", monitors.EventType.Create))) self.driver.add(InfoEvent(1, monitors.EventInfo( self.dir / "foo", monitors.EventType.Modify))) self.driver.run()
def testInfo(self): self.driver.add(InfoEvent(1, monitors.EventInfo())) self.driver.run() self.assertEventCount(1)
def testBadDelete(self): self.driver.add(InfoEvent(1, monitors.EventInfo( self.dir / "foo", monitors.EventType.Delete))) self.driver.run() self.assertErrors()
def testSimpleCreate(self): self.driver.add(InfoEvent(1, monitors.EventInfo( old_div(self.dir, "foo"), monitors.EventType.Create))) self.driver.run()
def testBad(self): self.driver.add(InfoEvent(1, monitors.EventInfo( "foo", monitors.EventType.Create))) self.driver.run() self.assertErrors()
def testDirectoryDoesntExistOnModify(self): self.driver.add(DirInfoEvent(1, monitors.EventInfo( self.dir / "dir", monitors.EventType.Modify))) self.driver.run() self.assertErrors()
def testBadModify(self): self.driver.add(InfoEvent(1, monitors.EventInfo( self.dir / "foo", monitors.EventType.Modify))) self.driver.run() self.assertErrors()