Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix api token test bug
  • Loading branch information
AsafPolakovski committed Jul 7, 2022
commit 6d9d1fde95c2a1ffc180a8687b26bec7255c91b9
8 changes: 5 additions & 3 deletions e2e_tests/api_token_test.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import os
import unittest
from datetime import datetime
from datetime import datetime, timedelta
from unit import Unit
from unit.models.api_token import CreateAPITokenRequest
from unit.utils.date_utils import from_datetime

token = os.environ.get('TOKEN')
client = Unit("https://api.s.unit.sh", token)
user_id = "252"
expiration_time = datetime.now() + timedelta(hours=1)

def create_api_token():
request = CreateAPITokenRequest(user_id, "Test token", "customers applications", datetime(2022, 7, 1, 13, 47, 17))
request = CreateAPITokenRequest(user_id, "Test token", "customers applications", expiration_time)
return client.api_tokens.create(request).data

def test_list_api_tokens():
Expand All @@ -24,7 +26,7 @@ def test_create_api_token():
assert api_token.type == "apiToken"

def test_create_api_token_prev_version( ):
request = CreateAPITokenRequest(user_id, "Test token", "customers applications", "2022-07-01T13:47:17.000Z")
request = CreateAPITokenRequest(user_id, "Test token", "customers applications", from_datetime(expiration_time))
api_token = client.api_tokens.create(request).data
assert api_token.type == "apiToken"

Expand Down