Skip to content

Add unit tests for weather endpoint error handling #218

Description

@nivedithabinu

In alertsystem.py, the /weather endpoint contains several error-handling branches but currently lacks the required test coverage.

This includes:

  1. Missing city/state/country input
  2. Missing OPENWEATHER_API_KEY
  3. Invalid location not found
  4. Unexpected internal exceptions

Without automated tests, future changes may accidentally break these error-handling paths without being detected.

To resolve this issue, we can cover these pytest test cases:

  1. Missing required fields that return HTTP 400
  2. Missing API key that return HTTP 500
  3. Invalid location that return HTTP 404
  4. Internal server exceptions that return HTTP 500

This will further improve the backend automation on this project.

I'd like to work on this issue if approved.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions