COSC381-2023Fall/final-project-CinmonTost
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
# My FastAPI Project
This project contains a FastAPI application with a simple HelloWorld API method.
## How to Run
1. **Setting up the FastAPI application:**
- Install required dependencies:
```bash
pip install -r requirements.txt
```
- Run the FastAPI application:
```bash
uvicorn main:app --reload
```
- Access the API documentation by opening a browser and navigating to:
```
http://localhost:8000/docs
```
This opens the Swagger UI where you can interact with the API methods.
2. **Testing the `get_movie_reviews()` method:**
- Ensure the FastAPI application is running.
- Create a new Python test file or update an existing one (e.g., `test_youtube_search.py`) to test the `get_movie_reviews()` method. You can use libraries like `pytest` for testing.
- Run the tests using `pytest`:
```bash
pytest test_youtube_search.py
```
- Validate that the tests cover different scenarios and assertions for the `get_movie_reviews()` function.
- Verify the behavior of the function by searching for reviews of different movie titles.
- Make sure to mock the YouTube search functionality for testing purposes and handle different possible responses.
3. **Interacting with the API:**
- Open the API documentation at `http://localhost:8000/docs`.
- To access the HelloWorld API method:
- Find the method named `read_root`.
- Click on it to expand the method details.
- Click on the "Try it out" button.
- Click "Execute" to see the response.
- This method provides a basic demonstration of the FastAPI functionality.
## Note
Please ensure that your machine has an active internet connection to perform YouTube searches when testing the `get_movie_reviews()` method.