def test_export_report(self): _id = self.report.id username = self.ionadmin.username comment = "abc" # returns method results directly result = iondb.rundb.data.tasks.export_report(username, _id, comment) self.assertEquals(result[0], True) verifyMessage(self, True, self.report.resultsName) verify(proxy).export_report(any(), contains(comment))
def test_archive_report_using_delay(self): _id = self.report.id username = self.ionadmin.username comment = "abc" proxy = mock() when(xmlrpclib).ServerProxy(any(), allow_none=any()).thenReturn(proxy) proxyResult = True when(proxy).archive_report(any(), any()).thenReturn(proxyResult) #returns ASyncResult wrapping method invocation results result = iondb.backup.tasks.archive_report.delay(username, _id, comment) self.assertEquals(result.get()[0], proxyResult) verifyMessage(self, proxyResult, self.report.resultsName) verify(proxy).archive_report(any(), contains(comment))
def test_archive_report(self): _id = self.report.id username = self.ionadmin.username comment = "abc" proxy = mock() when(xmlrpclib).ServerProxy(any(), allow_none=any()).thenReturn(proxy) proxyResult = True when(proxy).archive_report(any(), any()).thenReturn(proxyResult) # returns method results directly result = iondb.backup.tasks.archive_report(username, _id, comment) self.assertEquals(result[0], proxyResult) verifyMessage(self, proxyResult, self.report.resultsName) verify(proxy).archive_report(any(), contains(comment))