def test_get_by_id(self): ctxt = context.get_admin_context() self.mox.StubOutWithMock(db, 'migration_get') db.migration_get(ctxt, fake_migration['id']).AndReturn(fake_migration) self.mox.ReplayAll() mig = migration.Migration.get_by_id(ctxt, fake_migration['id']) self._compare(mig, fake_migration)
def get_by_id(cls, context, migration_id): db_migration = db.migration_get(context, migration_id) return cls._from_db_object(context, cls(), db_migration)