diff --git a/clarifai/client/user.py b/clarifai/client/user.py index 67d05678..3d8d42ce 100644 --- a/clarifai/client/user.py +++ b/clarifai/client/user.py @@ -361,7 +361,10 @@ def app(self, app_id: str, **kwargs) -> App: raise Exception(response.status) kwargs['user_id'] = self.id - return App.from_auth_helper(auth=self.auth_helper, app_id=app_id, **kwargs) + kwargs['app_id'] = app_id + app = App.from_auth_helper(auth=self.auth_helper, **kwargs) + app.app_info.CopyFrom(response.app) + return app def runner(self, runner_id: str) -> dict: """Returns a Runner object if exists. diff --git a/tests/test_app.py b/tests/test_app.py index a5a3caf1..26cabdf1 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -173,6 +173,17 @@ def test_patch_app(self, create_client, caplog): ) assert "SUCCESS" in caplog.text + def test_get_app(self, create_client): + # Verify that user.app() returns actual server data, not empty/default values + app = create_client.app(app_id=CREATE_APP_ID) + # These should match what was set in test_patch_app + assert app.app_info.visibility.gettable == 10, ( + f"Expected visibility 10, got {app.app_info.visibility.gettable}" + ) + assert app.app_info.description == 'App Patching Test', ( + f"Expected description 'App Patching Test', got '{app.app_info.description}'" + ) + def test_patch_dataset(self, create_app, caplog): with caplog.at_level(logging.INFO): create_app.patch_dataset(