Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed modify_g fixture #58

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ def app_config(client):
yield client.application


@pytest.fixture()
def modify_g(client):
g.auth_user = {"id": 1}
g.user = "test"
g.id = 1


@pytest.fixture()
def mock_info_service():
aligned_volume_url = os.path.join(INFOSERVICE_ENDPOINT, "api/aligned_volumes")
Expand Down
29 changes: 13 additions & 16 deletions test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_post_table(self, client):
"table_name": "test_table",
"schema_type": "synapse",
"metadata": {
"user_id": "1",
"user_id": "0",
"description": "Test description",
"flat_segmentation_source": "precomputed://gs://my_cloud_bucket/image",
"voxel_resolution_x": 4,
Expand All @@ -47,19 +47,13 @@ def test_post_table(self, client):
logging.info(response)
assert response.json is None

def test_put_table(self, client, modify_g):
"""
These tests have to be run in sequential order, so instead of trusting
the testing framework to run independent tests in the intended order,
simply package them into a single function.
"""

def test_put_table1(self, client):
# Alter the description and populate the notice_text
logging.info("TEST")
data = {
"table_name": "test_table",
"metadata": {
"user_id": "1",
"user_id": "0",
"description": "Altered test description",
"flat_segmentation_source": "precomputed://gs://my_cloud_bucket/image",
"notice_text": "Notice",
Expand All @@ -81,13 +75,14 @@ def test_put_table(self, client, modify_g):
assert response.json["description"] == "Altered test description"
assert response.json["notice_text"] == "Notice"

def test_put_table2(self, client):
# ================================================================================
# Test that notice_text is erased
logging.info("TEST")
data = {
"table_name": "test_table",
"metadata": {
"user_id": "1",
"user_id": "0",
"notice_text": "",
},
}
Expand All @@ -106,13 +101,14 @@ def test_put_table(self, client, modify_g):
logging.info(response)
assert response.json["notice_text"] is None

def test_put_table3(self, client):
# ================================================================================
# Repopulate notice_text
logging.info("TEST")
data = {
"table_name": "test_table",
"metadata": {
"user_id": "1",
"user_id": "0",
"notice_text": "Notice2",
},
}
Expand All @@ -131,13 +127,14 @@ def test_put_table(self, client, modify_g):
logging.info(response)
assert response.json["notice_text"] == "Notice2"

def test_put_table4(self, client):
# ================================================================================
# Test that notice_text is erased
logging.info("TEST")
data = {
"table_name": "test_table",
"metadata": {
"user_id": "1",
"user_id": "0",
"notice_text": "",
},
}
Expand All @@ -162,7 +159,7 @@ def test_post_table_to_be_deleted(self, client):
"table_name": "test_table_to_delete",
"schema_type": "synapse",
"metadata": {
"user_id": "1",
"user_id": "0",
"description": "Test description",
"flat_segmentation_source": "precomputed://gs://my_cloud_bucket/image",
"voxel_resolution_x": 4,
Expand Down Expand Up @@ -222,7 +219,7 @@ def test_get_table_metadata(self, client):
"voxel_resolution_y": 4.0,
"valid": True,
"schema_type": "synapse",
"user_id": "1",
"user_id": "0",
"notice_text": None,
"reference_table": None,
"voxel_resolution_x": 4.0,
Expand All @@ -235,7 +232,7 @@ def test_get_table_metadata(self, client):
del response_json["last_modified"]
assert response_json == metadata

def test_mark_table_to_delete(self, client, modify_g):
def test_mark_table_to_delete(self, client):
url = f"/annotation/api/v2/aligned_volume/{aligned_volume_name}/table/test_table_to_delete"

with mock.patch(
Expand All @@ -261,7 +258,7 @@ def test_get_row_count(self, client):


class TestAnnotationsEndpoints:
def test_post_annotations(self, client, modify_g):
def test_post_annotations(self, client):
url = f"/annotation/api/v2/aligned_volume/{aligned_volume_name}/table/test_table/annotations"
data = {
"annotations": [
Expand Down
Loading