sachin1801 commited on
Commit
d963dcd
·
1 Parent(s): 068e060

ci fix for the api

Browse files
Files changed (1) hide show
  1. webapp/tests/test_api.py +12 -11
webapp/tests/test_api.py CHANGED
@@ -121,8 +121,8 @@ class TestBatchEndpoint:
121
  def test_batch_predict(self, client):
122
  """Test batch prediction."""
123
  sequences = [
124
- "GGTAGTACGCCAATTCGCCGGTGCCGCGAGCCAGAGGCTACCAAAACTTGACAAGCCTACATATACTACT",
125
- "CTACCACCTCCCAAGCTTACACACTGTTTGATGAAAGGTCGCCACAACGTTCCCTCACCCCTAGTCTCGC",
126
  ]
127
 
128
  response = client.post(
@@ -145,8 +145,8 @@ class TestBatchEndpoint:
145
  class TestExportEndpoint:
146
  """Tests for /api/export endpoint."""
147
 
148
- def test_export_json(self, client):
149
- """Test exporting results as JSON."""
150
  # First create a prediction
151
  sequence = "GGTAGTACGCCAATTCGCCGGTGCCGCGAGCCAGAGGCTACCAAAACTTGACAAGCCTACATATACTACT"
152
  predict_response = client.post(
@@ -155,12 +155,12 @@ class TestExportEndpoint:
155
  )
156
  job_id = predict_response.json()["job_id"]
157
 
158
- # Export as JSON
159
- response = client.get(f"/api/export/{job_id}/json")
160
  assert response.status_code == 200
161
 
162
- def test_export_csv(self, client):
163
- """Test exporting results as CSV."""
164
  # First create a prediction
165
  sequence = "GGTAGTACGCCAATTCGCCGGTGCCGCGAGCCAGAGGCTACCAAAACTTGACAAGCCTACATATACTACT"
166
  predict_response = client.post(
@@ -172,6 +172,7 @@ class TestExportEndpoint:
172
  # Export as CSV
173
  response = client.get(f"/api/export/{job_id}/csv")
174
  assert response.status_code == 200
175
- data = response.json()
176
- assert "content" in data
177
- assert "sequence" in data["content"] # CSV header should include sequence
 
 
121
  def test_batch_predict(self, client):
122
  """Test batch prediction."""
123
  sequences = [
124
+ {"name": "seq1", "sequence": "GGTAGTACGCCAATTCGCCGGTGCCGCGAGCCAGAGGCTACCAAAACTTGACAAGCCTACATATACTACT"},
125
+ {"name": "seq2", "sequence": "CTACCACCTCCCAAGCTTACACACTGTTTGATGAAAGGTCGCCACAACGTTCCCTCACCCCTAGTCTCGC"},
126
  ]
127
 
128
  response = client.post(
 
145
  class TestExportEndpoint:
146
  """Tests for /api/export endpoint."""
147
 
148
+ def test_export_csv_basic(self, client):
149
+ """Test exporting results as CSV."""
150
  # First create a prediction
151
  sequence = "GGTAGTACGCCAATTCGCCGGTGCCGCGAGCCAGAGGCTACCAAAACTTGACAAGCCTACATATACTACT"
152
  predict_response = client.post(
 
155
  )
156
  job_id = predict_response.json()["job_id"]
157
 
158
+ # Export as CSV
159
+ response = client.get(f"/api/export/{job_id}/csv")
160
  assert response.status_code == 200
161
 
162
+ def test_export_csv_content(self, client):
163
+ """Test exporting results as CSV with proper content."""
164
  # First create a prediction
165
  sequence = "GGTAGTACGCCAATTCGCCGGTGCCGCGAGCCAGAGGCTACCAAAACTTGACAAGCCTACATATACTACT"
166
  predict_response = client.post(
 
172
  # Export as CSV
173
  response = client.get(f"/api/export/{job_id}/csv")
174
  assert response.status_code == 200
175
+ assert response.headers["content-type"] == "text/csv; charset=utf-8"
176
+ csv_content = response.text
177
+ assert "sequence" in csv_content # CSV header should include sequence
178
+ assert "psi" in csv_content # CSV header should include psi