def testAddNewBackend(self): """ When a new backend is added, the returned parameters must be those of the database. """ dbParams1 = DatabaseParameters(landmarks=[AlphaHelix], trigPoints=[Peaks]) db = Database(dbParams1) name, checksum, dbParams2 = db.addBackend() self.assertIs(dbParams1, dbParams2)
def testReconnectSameNameBackend(self): """ If a backend tries to connect but re-uses an existing backend name, a BackendException must be raised. """ dbParams = DatabaseParameters(landmarks=[AlphaHelix]) db = Database(dbParams) name, checksum, dbParams = db.addBackend() error = "^Backend %r is already connected\.$" % name six.assertRaisesRegex(self, BackendException, error, db.addBackend, name)