File size: 742 Bytes
7f6ef8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
This file contains shared pytest fixtures for all test files.
Fixtures defined here are automatically available to all test files.
"""

import pytest
import os
import sys
from flask import Flask

# Add the parent directory to sys.path to allow importing from the backend package
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))

# Import the Flask app for testing
from backend.app import app


@pytest.fixture
def client():
    """Create a test client for the Flask app."""
    app.config['TESTING'] = True
    with app.test_client() as client:
        yield client


@pytest.fixture
def app_context():
    """Create an application context for the Flask app."""
    with app.app_context():
        yield