Problem with (not) Locking Tables during Restore
The reason the server is complaining that 'User' was not locked is because of this:

/*!40000 ALTER TABLE `User` DISABLE KEYS */;


That looks like a comment, but it isn't a comment.  MySQL has a special case for comment parsing for backward-compatibility and cross-compatibility.

Comments in this style are processed as if they weren't comments at all, if the server's version is greater than or equal to the number shown, so in this case, any version of MySQL Server 4.0.0 or greater will execute it and any prior version won't.

So, the restore is asking the server to ALTER a table that isn't locked.  You can only do that when your session has no tables locked at all.  

If you change that table name to your test table name, the restore should work.

In similar style, if there's an exclamation point in the first position followed by a space, it will be parsed as if not a comment by all versions of MySQL.