Do not run tests if there is no secrets
This commit is contained in:
parent
4385b3f151
commit
b3c2d9408e
|
@ -2,6 +2,9 @@ import secret_loader
|
|||
|
||||
secrets = secret_loader.SecretLoader()
|
||||
|
||||
def has_secrets():
|
||||
return secrets.load('FAVRO_ORGANIZATION_ID') is not None
|
||||
|
||||
|
||||
def favro_org_id():
|
||||
return secrets.load_or_fail('FAVRO_ORGANIZATION_ID')
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
import pytest
|
||||
|
||||
from favro_sync import secrets
|
||||
from favro_sync.favro_client import FavroClient, OrganizationId, SeqId
|
||||
|
||||
# TODO: Skip if no secrets
|
||||
|
||||
|
||||
def test_create_client():
|
||||
client = FavroClient(
|
||||
favro_org_id=OrganizationId(secrets.favro_org_id()),
|
||||
favro_username=secrets.favro_username(),
|
||||
favro_password=secrets.favro_password(),
|
||||
read_only=True,
|
||||
needs_secrets = pytest.mark.skipif(
|
||||
not secrets.has_secrets(),
|
||||
reason='Secrets required',
|
||||
)
|
||||
|
||||
|
||||
@needs_secrets
|
||||
def test_create_client():
|
||||
client = create_client()
|
||||
assert client is not None
|
||||
client.check_logged_in()
|
||||
return client
|
||||
|
||||
|
||||
@needs_secrets
|
||||
def test_get_card():
|
||||
client = test_create_client()
|
||||
client = create_client()
|
||||
card = client.get_card(SeqId(11368))
|
||||
print(card)
|
||||
|
||||
|
@ -27,3 +28,11 @@ def test_get_card():
|
|||
assert len(card.dependencies) == 1
|
||||
assert len(card.attachments) == 0
|
||||
assert len(card.custom_fields) == 2
|
||||
|
||||
def create_client():
|
||||
return FavroClient(
|
||||
favro_org_id=OrganizationId(secrets.favro_org_id()),
|
||||
favro_username=secrets.favro_username(),
|
||||
favro_password=secrets.favro_password(),
|
||||
read_only=True,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user