Skip to content

Commit

Permalink
environment set test
Browse files Browse the repository at this point in the history
  • Loading branch information
aktech committed Aug 21, 2023
1 parent 711e113 commit 5ad961b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
on: push

env:
CIRUN_API_KEY: ramdom-api-key

name: Test
jobs:
test:
Expand Down
15 changes: 12 additions & 3 deletions cirun/tests/test_integration.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
import os

import pytest

from cirun import Cirun

MSG_401 = "This API Key is expired or non-existent."


def test_access_control_add_repo_to_resource_401():
@pytest.fixture
def set_api_key():
os.environ['CIRUN_API_KEY'] = "random-key"


def test_access_control_add_repo_to_resource_401(set_api_key):
cirun = Cirun()
response = cirun.add_repo_to_resources("cirun", "cirun-py", resources=["cirun-runner-1"])
assert response.status_code == 401
assert response.json() == {"message": MSG_401}


def test_access_control_remove_repo_from_resource_401():
def test_access_control_remove_repo_from_resource_401(set_api_key):
cirun = Cirun()
response = cirun.add_repo_to_resources("cirun", "cirun-py", resources=["cirun-runner-1"])
assert response.status_code == 401
assert response.json() == {"message": MSG_401}


def test_get_repo_resources():
def test_get_repo_resources(set_api_key):
cirun = Cirun()
cirun.get_repo_resources(org="aktechlabs", repo="cirun-py")

0 comments on commit 5ad961b

Please sign in to comment.