Skip to content

Commit

Permalink
temp edit
Browse files Browse the repository at this point in the history
  • Loading branch information
jladrover committed Apr 14, 2024
1 parent 4090def commit 0660aae
Showing 1 changed file with 0 additions and 53 deletions.
53 changes: 0 additions & 53 deletions web-app/test_main.py
Original file line number Diff line number Diff line change
@@ -1,53 +0,0 @@
# test_main.py
import pytest
from flask import url_for
from io import BytesIO
from web_app.main import app


@pytest.fixture
def client():
app.config['TESTING'] = True
with app.test_client() as client:
yield client

def test_index(client):
response = client.get(url_for('index'))
assert response.status_code == 200

def test_upload_file_no_file(client):
response = client.post(url_for('upload_file'))
assert response.status_code == 200
assert response.get_json() == {'message': 'No file uploaded'}

def test_upload_file_with_file(client):
data = {
'photo': (BytesIO(b'my file contents'), 'test.jpg')
}
response = client.post(url_for('upload_file'), content_type='multipart/form-data', data=data)
assert response.status_code == 200
assert 'message' in response.get_json()
assert 'results' in response.get_json()
@pytest.fixture
def client():
app.config['TESTING'] = True
with app.test_client() as client:
yield client

def test_index(client):
response = client.get(url_for('index'))
assert response.status_code == 200

def test_upload_file_no_file(client):
response = client.post(url_for('upload_file'))
assert response.status_code == 200
assert response.get_json() == {'message': 'No file uploaded'}

def test_upload_file_with_file(client):
data = {
'photo': (BytesIO(b'my file contents'), 'test.jpg')
}
response = client.post(url_for('upload_file'), content_type='multipart/form-data', data=data)
assert response.status_code == 200
assert 'message' in response.get_json()
assert 'results' in response.get_json()

0 comments on commit 0660aae

Please sign in to comment.