-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
12 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |