Skip to content

Instantly share code, notes, and snippets.

@remyleone
Created March 13, 2018 16:52
Show Gist options
  • Select an option

  • Save remyleone/c16caf9d8af5c83e70f1a09fac568510 to your computer and use it in GitHub Desktop.

Select an option

Save remyleone/c16caf9d8af5c83e70f1a09fac568510 to your computer and use it in GitHub Desktop.
"""
Testing for account API
"""
import os
import requests
token = os.getenv('SCW_TOKEN', "Insert your API Token here if you don't want to define environment variable")
def test_get_token():
"""
This will give you the token available for your account.
"""
r = requests.get("https://account.scaleway.com/tokens",
headers={'X-Auth-Token': token,
"Content-Type": "application/json"})
print(r.text)
assert r.ok
def test_post_token():
r = requests.post("https://account.scaleway.com/tokens",
headers={'X-Auth-Token': token,
"Content-Type": "application/json"})
print(r.text)
assert r.ok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment