Refactored tests and added tests checking syncing TENANT_APPS and SHARED_APPS behavior.