Skip to content

Commit

Permalink
Add marks to all integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jackleland committed Dec 2, 2024
1 parent 1e923cd commit d746f59
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
11 changes: 8 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "atlasapiclient"
version = "v0.1.0"

version = "v0.1.0"
authors = [
{name = "Heloise Stevance", email = "[email protected]"},
]
Expand All @@ -26,7 +25,13 @@ dependencies = [

# See some of the stuff I have in the hoki .toml file


[tool.pytest.ini_options]
markers = [
"slow: marks tests as slow",
"integration: mark tests as requiring additional infrastructure",
"serial",
]

[project.optional-dependencies]
test = ["pytest"]
#pdf = ["ReportLab>=1.2", "RXP"]
Expand Down
Empty file added test/integration/__init__.py
Empty file.
12 changes: 7 additions & 5 deletions test/integration/test_api_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
These tests only work if you have a token for the ATLAS api.
"""
import pytest
import os
import pkg_resources
import numpy as np

from atlasapiclient.exceptions import ATLASAPIClientError
import atlasapiclient as atlasapi
from atlasapiclient.utils import API_CONFIG_FILE

# NOTE: These are more integration tests than unit tests

@pytest.mark.integration
class TestAPIClient():
def test_instanciate_with_my_config(self):
atlas_base = atlasapi.client.APIClient(API_CONFIG_FILE)
Expand All @@ -22,6 +22,7 @@ def test_instanciate_without_config(self):

OBJECT_ID = '1000506771295744900'

@pytest.mark.integration
class TestRequestVRAScores():

def test_instanciate_with_my_config(self):
Expand All @@ -48,6 +49,7 @@ def test_get_response_on_instanciation_empty_payload(self):
get_response=True
)

@pytest.mark.integration
class TestRequestCustomListsTable():
def test_instanciate_with_my_config(self):
request_custom_lists = atlasapi.client.RequestCustomListsTable(api_config_file = API_CONFIG_FILE)
Expand All @@ -66,7 +68,7 @@ def test_request_custom_list(self):
request_custom_lists.get_response()
assert request_custom_lists.request.status_code == 200, "Data wasn't read properly"


@pytest.mark.integration
class TestRequestSingleSourceData():
# atlas_id = '1103337110432157700'
atlas_id = '1000240741164042800'
Expand All @@ -83,7 +85,7 @@ def test_get_response(self):
request_single_source.get_response()



@pytest.mark.integration
class TestRequestMultipleSourceData():
# array_ids = np.array([1103337110432157700, 1063637771185950900])
array_ids = np.array([1000315271160844000, 1000240741164042800])
Expand Down
15 changes: 9 additions & 6 deletions test/integration/test_api_write.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
"""
These tests only work if you have a token for the ATLAS api.
"""
import pytest
import os
import pkg_resources

import pytest
import numpy as np
from atlasapiclient.exceptions import St3ph3nSaysNo
import atlasapiclient as atlasapi
import atlasapiclient.client as atlasapi
from atlasapiclient.utils import API_CONFIG_FILE

# NOTE: These are integration tests require data from the ST3PH3N API
data_path = pkg_resources.resource_filename('st3ph3n', 'data')
API_CONFIG_FILE = atlasapi.utils.API_CONFIG_FILE

# data_path = pkg_resources.resource_filename('st3ph3n', 'data')
# API_CONFIG_FILE = API_CONFIG_FILE

@pytest.mark.integration
class TestWriteToVRAScores():
def test_instanciate_with_my_config(self):
writeto_vra = atlasapi.WriteToVRAScores(api_config_file = API_CONFIG_FILE)
Expand Down Expand Up @@ -54,6 +55,7 @@ def test_payload_is_bad(self):
get_response=True
)

@pytest.mark.integration
class TestWriteToVRARank():
def test_instanciate_with_my_config(self):
writeto_vra = atlasapi.WriteToVRARank(api_config_file = API_CONFIG_FILE)
Expand All @@ -72,6 +74,7 @@ def test_send_something(self):
assert writeto_rank.request.status_code == 201, "Data wasn't written properly"


@pytest.mark.integration
class TestWriteRemoveCustomList():
def test_write_to_custom_list(self):
writeto_vra = atlasapi.WriteToCustomList(api_config_file = API_CONFIG_FILE,
Expand Down

0 comments on commit d746f59

Please sign in to comment.