def testDownloadPicture(self): if os.path.exists('test.jpg'): os.remove('test.jpg') biaflows = BIAFlows() biaflows.downloadPicture('/api/attachedfile/', '5363317', 'test.jpg') fileExists = os.path.exists('test.jpg') self.assertEquals(fileExists, True) os.remove('test.jpg')
def __init__(self): ''' Create and display the connection window. ''' super(ConnectionWindow, self).__init__("BIAFlows Connection") self.biaflows = BIAFlows.getInstance() self.createAndShowGUI() self.addWindowListener(self) WindowManager.addWindow(self)
def setUp(self): biaflows = BIAFlows('http://biaflows/', '7fe8b526-93ae-481e-932d-e1e0bb598529', '45953ccd-0984-4471-ba68-31c6d212699a') IJ.newImage("Ramp", "8-bit ramp", 256, 256, 1) imp = IJ.getImage() IJ.saveAs("tiff", "./ctest.tif") imp.close() projects = Projects() names = projects.getNames() ids = projects.getIDs() index = -1 pid = -1 try: index = names.index('upload-test') pid = ids[index] except ValueError, e: p = Project(name, Ontology('upload-test')).save() pid = p.getId()
def setUp(self): BIAFlows()
def testGetInstance(self): newInst = BIAFlows.getInstance() existingInst = BIAFlows.getInstance() self.assertEquals(newInst, existingInst) self.assertEquals(existingInst.getHost(), 'https://biaflows.neubias.org')
def testGetUploadURL(self): biaflows = BIAFlows.getInstance() url = biaflows.getUploadURL() self.assertEquals(url.find('-upload')>=0, True)
def testSetPrivateKey(self): biaflows = BIAFlows.getInstance() biaflows.setPrivateKey("k2k2k2"); self.assertEquals(BIAFlows.getInstance().getPrivateKey(), 'k2k2k2')
def testGetPrivateKey(self): self.assertEquals(BIAFlows.getInstance().getPrivateKey(), '73b7df42-3484-4c1b-9bf2-8d9e3ea53eac')
def testSetPublicKey(self): biaflows = BIAFlows.getInstance() biaflows.setPublicKey("k1k1k1"); self.assertEquals(BIAFlows.getInstance().getPublicKey(), 'k1k1k1')
def testGetPublicKey(self): self.assertEquals(BIAFlows.getInstance().getPublicKey(), 'c0f3be78-a1a7-4d86-ad09-9e1753f26a8b')
def testSetHost(self): biaflows = BIAFlows() biaflows.setHost("a.b.c") self.assertEquals(biaflows.getHost(), 'a.b.c')
def testGetHost(self): biaflows = BIAFlows() self.assertEquals(biaflows.getHost(), 'https://biaflows.neubias.org')
def testConstructorWithArgs(self): biaflows = BIAFlows('https://url.org', '000', '111') self.assertEquals(biaflows.getHost(), 'https://url.org')
def testConstructorNoArgs(self): biaflows = BIAFlows() self.assertEquals(biaflows.getHost(), 'https://biaflows.neubias.org')