Fixed #23352 -- Added tests for MigrationGraph.{forwards,backwards}_plan

Test for ValueError raised by MigrationGraph.forwards_plan and
MigrationGraph.backwards_plan.
simply missed it