Skip to content

Commit

Permalink
adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kcutler0 committed Aug 22, 2023
1 parent 4f7ebc2 commit 329f527
Show file tree
Hide file tree
Showing 6 changed files with 350 additions and 63 deletions.
63 changes: 0 additions & 63 deletions test/test_integration/test_auth-sdk-new.py

This file was deleted.

43 changes: 43 additions & 0 deletions test/test_integration/test_get_samples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import icasdk
from icasdk.apis.tags import sample_api
from icasdk.model.sample_paged_list import SamplePagedList
from icasdk.model.problem import Problem
from pprint import pprint
import os
from dotenv import load_dotenv


def test_sample_list():
# Defining the host is optional and defaults to /ica/rest
# See configuration.py for a list of all supported configuration parameters.
load_dotenv()
configuration = icasdk.Configuration(host="https://ica.illumina.com/ica/rest")

# Configure HTTP basic authorization: BasicAuth
configuration.api_key["ApiKeyAuth"] = os.getenv("APIKEY")

with icasdk.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = sample_api.SampleApi(api_client)

# example passing only required values which don't have defaults set
query_params = {
"region": "c39b1feb-3e94-4440-805e-45e0c76462bf",
}
try:
# Retrieve a list of samples.
api_response = api_instance.get_samples(
query_params=query_params,
)
pprint(api_response)
except icasdk.ApiException as e:
print("Exception when calling SampleApi->get_samples: %s\n" % e)

items = api_response.body["items"]
sampleList = []
for i in items:
sampleList.append(i.get_item_oapg("id"))
pprint(i.get_item_oapg("id"))

assert "038eeae2-6e56-43fd-9973-0d2da84283b7" in sampleList
assert api_response.response.status == 200
40 changes: 40 additions & 0 deletions test/test_integration/test_get_storage_credentials_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import icasdk
from icasdk.apis.tags import storage_credentials_api
from icasdk.model.problem import Problem
from icasdk.model.storage_credential_list import StorageCredentialList
from pprint import pprint

import os
from dotenv import load_dotenv


def test_storage_credential_list():
# Defining the host is optional and defaults to /ica/rest
# See configuration.py for a list of all supported configuration parameters.
load_dotenv()
configuration = icasdk.Configuration(host="https://ica.illumina.com/ica/rest")

# Configure HTTP basic authorization: BasicAuth
configuration.api_key["ApiKeyAuth"] = os.getenv("APIKEY")
with icasdk.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = storage_credentials_api.StorageCredentialsApi(api_client)

# example, this endpoint has no required or optional parameters
try:
# Retrieve a list of storage credentials.
api_response = api_instance.get_storage_credentials()
pprint(api_response)
except icasdk.ApiException as e:
print(
"Exception when calling StorageCredentialsApi->get_storage_credentials: %s\n"
% e
)

items = api_response.body["items"]
credList = []
for i in items:
credList.append(i.get_item_oapg("id"))
pprint(i.get_item_oapg("id"))
assert "7f087458-42d3-4ca2-bc96-1de1dbdc0fd9" in credList
assert api_response.response.status == 200
41 changes: 41 additions & 0 deletions test/test_integration/test_get_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import icasdk
from icasdk.apis.tags import user_api
from icasdk.model.user_list import UserList
from icasdk.model.problem import Problem
from pprint import pprint

import os
from dotenv import load_dotenv


def test_user_list():
# Defining the host is optional and defaults to /ica/rest
# See configuration.py for a list of all supported configuration parameters.
load_dotenv()
configuration = icasdk.Configuration(host="https://ica.illumina.com/ica/rest")

# Configure HTTP basic authorization: BasicAuth
configuration.api_key["ApiKeyAuth"] = os.getenv("APIKEY")

with icasdk.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = user_api.UserApi(api_client)

# example passing only optional values
query_params = {}
try:
# Retrieve a list of users.
api_response = api_instance.get_users(
query_params=query_params,
)
pprint(api_response)
except icasdk.ApiException as e:
print("Exception when calling UserApi->get_users: %s\n" % e)

items = api_response.body["items"]
userList = []
for i in items:
userList.append(i.get_item_oapg("id"))
pprint(i.get_item_oapg("id"))
assert "47793c21-75a6-3aa8-8147-81b354d0af4d" in userList
assert api_response.response.status == 200
38 changes: 38 additions & 0 deletions test/test_integration/test_get_workgroups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import icasdk
from icasdk.apis.tags import workgroup_api
from icasdk.model.problem import Problem
from icasdk.model.workgroup_list import WorkgroupList
from pprint import pprint

import os
from dotenv import load_dotenv


def test_user_list():
# Defining the host is optional and defaults to /ica/rest
# See configuration.py for a list of all supported configuration parameters.
load_dotenv()
configuration = icasdk.Configuration(host="https://ica.illumina.com/ica/rest")

# Configure HTTP basic authorization: BasicAuth
configuration.api_key["ApiKeyAuth"] = os.getenv("APIKEY")

with icasdk.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = workgroup_api.WorkgroupApi(api_client)

# example, this endpoint has no required or optional parameters
try:
# Retrieve a list of workgroups.
api_response = api_instance.get_workgroups()
pprint(api_response)
except icasdk.ApiException as e:
print("Exception when calling WorkgroupApi->get_workgroups: %s\n" % e)

items = api_response.body["items"]
workgroupList = []
for i in items:
workgroupList.append(i.get_item_oapg("id"))
pprint(i.get_item_oapg("id"))
assert "00f97a19-02c3-334d-9ee1-083a65901406" in workgroupList
assert api_response.response.status == 200
Loading

0 comments on commit 329f527

Please sign in to comment.