Fix ticket 23699 Migrate in unittest still loads initial data

Fixed #23699 Migrate in unittest still loads initial data
Please check code with flake8 as described in the patch review checklist and correct the "no newline at end of file" warning here.