Metadata-Version: 2.4
Name: drf-mocker
Version: 0.1.0
Summary: A Django DRF mock response tool
Project-URL: Homepage, https://github.com/khodealib/drf-mock-response
Author-email: Ali Bagheri <khodealib@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Ali Bagheri
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
        documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
        rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
        persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
        Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
        WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
        COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
        OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
License-File: LICENSE
Keywords: django,drf,mock,response
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3.2
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.2
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: django>=3.2
Requires-Dist: djangorestframework>=3.12
Description-Content-Type: text/markdown

# drf-mock-response

📦 A lightweight mock response framework for Django REST Framework (DRF).  
Easily simulate API endpoints using static JSON files stored inside your Django apps.

---

## 🔧 Features

-   Plug & play mock API views (List, Detail, Update, Delete)
-   Supports `ViewSet`-based mocks
-   Loads JSON mock data from `json_mock/` directory inside each Django app
-   Customizable HTTP status code and response delay
-   No real DB or models required

---

## 📁 Project Structure

In each Django app:

```
your_app/
├── json_mock/
│ └── your_mock.json
├── views/
│ └── your_mock_views.py

```

---

## 🚀 Installation

```bash
pip install git+https://github.com/khodealib/drf-mock-response.git
```

Or after cloning:

```
pip install /path/to/drf_mock_response/
```

## 🧩 Usage

```python
# your_app/views/mocks.py

from drf_mock_response.views import MockListAPIView

class ProductListMock(MockListAPIView):
    json_filename = "product_list.json"
    mock_status = 200
    delay_seconds = 1
```

```python
# your_app/urls.py

from django.urls import path
from .views.mocks import ProductListMock

urlpatterns = [
    path("mock/products/", ProductListMock.as_view()),
]
```

Place your mock file in:

```
your_app/json_mock/product_list.json

```

### 🔁 ViewSet Example

```python
from drf_mock_response.viewsets import MockViewSet

class UserMockViewSet(MockViewSet):
    json_filename = "user_list.json"
```

And wire it with a router in your urls.py.

## ✅ Requirements

    Django ≥ 3.2
    djangorestframework ≥ 3.14

## 📄 License

MIT © 2025 Ali Bagheri
