Skip to content

Commit

Permalink
Create test_integration.py
Browse files Browse the repository at this point in the history
  • Loading branch information
karimosman89 authored Sep 21, 2024
1 parent c9255bb commit 52904e2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import unittest
import requests
import json

class TestIntegration(unittest.TestCase):
def test_prediction_endpoint(self):
"""Test the Flask prediction endpoint for a valid response"""
url = "http://localhost:5000/predict"
headers = {"Content-Type": "application/json"}
data = {
"image": [0.5] * 32 * 32 * 3 # Flattened 32x32x3 image for CIFAR-10
}
response = requests.post(url, headers=headers, data=json.dumps(data))
self.assertEqual(response.status_code, 200)
self.assertIn("prediction", response.json())

if __name__ == "__main__":
unittest.main()

0 comments on commit 52904e2

Please sign in to comment.