The implication was that it was a Secret Test of Character.

Celestia told Twilight that she had to save the Empire by herself, but in reality the test was to see if Twilight would be willing to give up her chance at passing the test to save the Empire.

she passed the real test with Flying Colors.