This is set of RESTful APIs with Django Rest Framework(DRF) for managing product catalog. The API provides:
- Creating, updating, listing and deleting products
- Searching for products
- Uploading product image
- Tests to check if the API are working correctly
-
Clone the repository
git clone https://github.com/sonaljain067/CatalogManager.git
-
Create a virtual environment
cd CatalogMaster
python3 -m venv env
orvirtualenv env
to create virtual environment named env -
Activate the virtual environment
In Ubuntu:source env/bin/activate
In Windows:.\env\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Setup database
python manage.py migrate
orpython3 manage.py migrate
-
Create a superuser
python manage.py createsuperuser
orpython3 manage.py createsuperuser
-
Run the server
python manage.py runserver
orpython3 manage.py runserver
GET /api/product/
- Retrives all products
POST /api/product/create
- Create a new product
PUT /api//product/<id>
- Update an existing product
DELETE /api/product/<id>
- Delete an existing product
- Test that API returns a list of products when no search is provided.
- Test that API returns a list of products when search is provided
- Test that API return a empty list when search is not
- Test that API create a product with only valid payload
- Test that API doesn't create product with invalid payload
- Test that API update a product with only valid payload
- Test that API doesn't create product with invalid payload
- Test that API delete a existing product
To test the test suite, run the command:
python manage.py test
or python3 manage.py test
This will run all the tests in tests.py file
The Catalog Manager API is documented using Postman. You can import the Postman Collection to get started.