-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
55 lines (37 loc) · 1.78 KB
/
README
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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.