Skip to content

Commit 8d55476

Browse files
committed
t fix:add test and fix auth-token
1 parent 116dc62 commit 8d55476

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

scaleway-core/scaleway_core/api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,12 @@ def _request(
140140

141141
headers = {
142142
"accept": "application/json",
143-
"x-auth-token": self.client.secret_key or "",
144143
"user-agent": self.client.user_agent,
145144
**additional_headers,
146145
**headers,
147146
}
147+
if self.client.secret_key is not None:
148+
headers["x-auth-token"] = self.client.secret_key
148149
url = f"{self.client.api_url}{path}"
149150

150151
logger = APILogger(self._log, self.client._increment_request_count())
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import logging
2+
import sys
3+
import unittest
4+
from scaleway_core.client import Client
5+
from scaleway.instance.v1 import InstanceV1API
6+
7+
logger = logging.getLogger()
8+
logger.level = logging.DEBUG
9+
stream_handler = logging.StreamHandler(sys.stdout)
10+
logger.addHandler(stream_handler)
11+
12+
13+
class TestTotalCountLegacy(unittest.TestCase):
14+
15+
def setUp(self) -> None:
16+
self.client = Client()
17+
self.instance_api = InstanceV1API(self.client, bypass_validation=True)
18+
19+
def test_list_servers_type(self):
20+
list_server_type = self.instance_api.list_servers_types(zone="fr-par-1")
21+
self.assertIsNotNone(list_server_type.total_count)
22+
23+

0 commit comments

Comments
 (0)