refactoring on app_api_test