Skip to content

Commit

Permalink
Drop the application.get_app_by_owner method
Browse files Browse the repository at this point in the history
Change-type: major
  • Loading branch information
otaviojacobi committed Sep 9, 2024
1 parent 369a63f commit 35e6a50
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 66 deletions.
19 changes: 0 additions & 19 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)[<code>List[TypeApplication]</code>](#typeapplication)
- [get_all_directly_accessible(options)](#application.get_all_directly_accessible)[<code>List[TypeApplication]</code>](#typeapplication)
- [get_by_name(app_name, options, context)](#application.get_by_name)[<code>TypeApplication</code>](#typeapplication)
- [get_by_owner(app_name, owner, options)](#application.get_by_owner)[<code>TypeApplication</code>](#typeapplication)
- [get_dashboard_url(app_id)](#application.get_dashboard_url) ⇒ <code>str</code>
- [get_directly_accessible(slug_or_uuid_or_id, options)](#application.get_directly_accessible)[<code>TypeApplication</code>](#typeapplication)
- [get_id(slug_or_uuid_or_id)](#application.get_id) ⇒ <code>int</code>
Expand Down Expand Up @@ -503,24 +502,6 @@ Get all applications directly accessible by the user
>>> balena.models.application.get("myapp")
```

<a name="application.get_by_owner"></a>
### Function: get_by_owner(app_name, owner, options) ⇒ [<code>TypeApplication</code>](#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')
```

<a name="application.get_dashboard_url"></a>
### Function: get_dashboard_url(app_id) ⇒ <code>str</code>

Expand Down
32 changes: 0 additions & 32 deletions balena/models/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
15 changes: 0 additions & 15 deletions tests/functional/models/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 35e6a50

Please sign in to comment.