Skip to content

Commit 24e9dc1

Browse files
committed
fix: new unit test, some name change
1 parent 39822c1 commit 24e9dc1

File tree

8 files changed

+590
-199
lines changed

8 files changed

+590
-199
lines changed

src/aleph/sdk/client/services/authenticated_port_forwarder.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async def _verify_status_processed_and_ownership(
5858
)
5959
return message, status
6060

61-
async def get_ports(
61+
async def get_address_ports(
6262
self, address: Optional[str] = None
6363
) -> AggregateConfig[AllForwarders]:
6464
"""
@@ -76,9 +76,9 @@ async def get_ports(
7676
raise ValueError("No account provided and client is not authenticated")
7777
address = self._client.account.get_address()
7878

79-
return await super().get_ports(address=address)
79+
return await super().get_address_ports(address=address)
8080

81-
async def get_port(
81+
async def get_ports(
8282
self, item_hash: ItemHash = None, address: Optional[str] = None
8383
) -> Optional[Ports]:
8484
"""
@@ -100,9 +100,9 @@ async def get_port(
100100
if item_hash is None:
101101
raise ValueError("item_hash must be provided")
102102

103-
return await super().get_port(address=address, item_hash=item_hash)
103+
return await super().get_ports(address=address, item_hash=item_hash)
104104

105-
async def create_port(
105+
async def create_ports(
106106
self, item_hash: ItemHash, ports: Ports
107107
) -> Tuple[AggregateMessage, MessageStatus]:
108108
"""
@@ -128,7 +128,7 @@ async def create_port(
128128
key=self.aggregate_key, content=content
129129
)
130130

131-
async def update_port(
131+
async def update_ports(
132132
self, item_hash: ItemHash, ports: Ports
133133
) -> Tuple[AggregateMessage, MessageStatus]:
134134
"""
@@ -176,7 +176,7 @@ async def delete_ports(
176176
# _, _ = await self._verify_status_processed_and_ownership(item_hash=item_hash)
177177

178178
# Get the Port Config of the item_hash
179-
port: Optional[Ports] = await self.get_port(item_hash=item_hash)
179+
port: Optional[Ports] = await self.get_ports(item_hash=item_hash)
180180
if not port:
181181
raise
182182

src/aleph/sdk/client/services/crn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async def get_last_crn_version(self):
4040
"""
4141
# Create a new session for external domain requests
4242
async with aiohttp.ClientSession() as session:
43-
async with session.get(settings.CRN_VERSION) as resp:
43+
async with session.get(settings.CRN_VERSION_URL) as resp:
4444
resp.raise_for_status()
4545
data = await resp.json()
4646
return data.get("tag_name")
@@ -133,6 +133,6 @@ async def update_instance_config(self, crn_address: str, item_hash: ItemHash):
133133
full_url = sanitize_url(crn_address + f"/control/{item_hash}/update")
134134

135135
async with aiohttp.ClientSession() as session:
136-
async with session.get(full_url) as resp:
136+
async with session.post(full_url) as resp:
137137
resp.raise_for_status()
138138
return await resp.json()

src/aleph/sdk/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class Settings(BaseSettings):
8787
DNS_API: ClassVar[str] = "https://api.dns.public.aleph.sh/instances/list"
8888
CRN_URL_UPDATE: ClassVar[str] = "{crn_url}/control/machine/{vm_hash}/update"
8989
CRN_LIST_URL: ClassVar[str] = "https://crns-list.aleph.sh/crns.json"
90-
CRN_VERSION: ClassVar[str] = (
90+
CRN_VERSION_URL: ClassVar[str] = (
9191
"https://api.github.com/repos/aleph-im/aleph-vm/releases/latest"
9292
)
9393
SCHEDULER_URL: ClassVar[str] = "https://scheduler.api.aleph.cloud/"

tests/unit/services/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)