diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index beb3700b..fe34a991 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -91,7 +91,6 @@ hesitate to open an issue in GitHub](https://github.com/balena-io/balena-sdk-pyt - [get_all_by_organization(org_handle_or_id, options)](#application.get_all_by_organization) ⇒ [List[TypeApplication]](#typeapplication) - [get_all_directly_accessible(options)](#application.get_all_directly_accessible) ⇒ [List[TypeApplication]](#typeapplication) - [get_by_name(app_name, options, context)](#application.get_by_name) ⇒ [TypeApplication](#typeapplication) - - [get_by_owner(app_name, owner, options)](#application.get_by_owner) ⇒ [TypeApplication](#typeapplication) - [get_dashboard_url(app_id)](#application.get_dashboard_url) ⇒ str - [get_directly_accessible(slug_or_uuid_or_id, options)](#application.get_directly_accessible) ⇒ [TypeApplication](#typeapplication) - [get_id(slug_or_uuid_or_id)](#application.get_id) ⇒ int @@ -503,24 +502,6 @@ Get all applications directly accessible by the user >>> balena.models.application.get("myapp") ``` - -### Function: get_by_owner(app_name, owner, options) ⇒ [TypeApplication](#typeapplication) - -Get a single application using the appname and the handle of the owning organization. - -#### Args: - app_name (str): application name. - owner (str): The handle of the owning organization. - options (AnyObject): extra pine options to use. - -#### Returns: - TypeApplication: application info. - -#### Examples: -```python ->>> balena.models.application.get_by_owner('foo', 'my_org') -``` - ### Function: get_dashboard_url(app_id) ⇒ str diff --git a/balena/models/application.py b/balena/models/application.py index 53c92935..729bdf23 100644 --- a/balena/models/application.py +++ b/balena/models/application.py @@ -2,7 +2,6 @@ from math import isinf from typing import List, Literal, Optional, Union, cast from urllib.parse import urljoin -from deprecated import deprecated from .. import exceptions from ..balena_auth import request @@ -403,37 +402,6 @@ def get_all_by_organization( } ) - @deprecated("get_by_owner will be removed in a future release, use get_all_by_organization instead") - def get_by_owner(self, app_name: str, owner: str, options: AnyObject = {}) -> TypeApplication: - """ - Get a single application using the appname and the handle of the owning organization. - - Args: - app_name (str): application name. - owner (str): The handle of the owning organization. - options (AnyObject): extra pine options to use. - - Returns: - TypeApplication: application info. - - Examples: - >>> balena.models.application.get_by_owner('foo', 'my_org') - """ - - slug = f"{owner.lower()}/{app_name.lower()}" - app = self.__pine.get( - { - "resource": "application", - "id": {"slug": slug}, - "options": options, - } - ) - - if app is None: - raise exceptions.ApplicationNotFound(slug) - - return app - def has(self, slug_or_uuid_or_id: Union[str, int]) -> bool: """ Check if an application exists. diff --git a/tests/functional/models/test_application.py b/tests/functional/models/test_application.py index cb9c65ac..23861c5b 100644 --- a/tests/functional/models/test_application.py +++ b/tests/functional/models/test_application.py @@ -72,21 +72,6 @@ def test_06_get_all_by_organization(self): self.balena.models.application.get_all_by_organization(self.org_id)[0]["app_name"], "FooBar" ) - def test_06_get_by_owner(self): - with self.assertRaises(self.helper.balena_exceptions.ApplicationNotFound): - self.balena.models.application.get_by_owner("AppNotExist", self.helper.credentials["user_id"]) - - self.assertEqual( - self.balena.models.application.get_by_owner("FooBar", self.helper.default_organization["handle"])[ - "app_name" - ], - "FooBar", - ) - - with self.assertRaises(Exception) as cm: - self.balena.models.application.get_by_owner("FooBar", "random_username") - self.assertIn("Application not found: random_username/foobar", cm.exception.message) # type: ignore - def test_07_has(self): self.assertFalse(self.balena.models.application.has("AppNotExist")) self.assertTrue(self.balena.models.application.has(self.app_slug))