Fix dangerous use self.app in init_app and test refactoring.

Hi guys, I would appreciate it someone could review this and merge into master.

Assigning `app` to `self` in the `init_app` method is strictly forbidden. Multiple apps with different configs might share the same flask_mongoengine instance and that currently leads to unexpected results. All app specific variables (anything depending on config) must be stored either on the application context or in the app object itself.

Thank you.