def test_astridCodeExists(self): # Note: this is not really a unit test, since it connects # to an external DB. This DB can be changed by anyone, # though it's a safe bet that this projects won't change. adb = AstridDB(dbname = "turtle_sim", test = True) r = adb.astridCodeExists("my little pony") self.assertEquals(False, r) r = adb.astridCodeExists("AGBT01A_020") self.assertEquals(True, r)
def test_addProjects(self): adb = AstridDB(dbname = "turtle_sim", test = True, quiet = True) self.assertEquals(adb.host, "gbtdata.gbt.nrao.edu") self.assertEquals(adb.user, "turtle_admin") self.assertEquals(adb.dbname, "turtle_sim") # make sure the DB is clean for acode in self.acodes: self.assertEquals(False, adb.astridCodeExists(acode)) # here's what we're actually testing adb.addProjects(self.pcodes) # make sure they got in, then clean up for acode in self.acodes: self.assertEquals(True, adb.astridCodeExists(acode)) adb.removeAstridCode(acode) self.assertEquals(False, adb.astridCodeExists(acode))