Skip to content

barseghyanartur/fake-py-django-storage

Repository files navigation

fake-py-django-storage

Django storage for fake.py.

PyPI Version Supported Python versions Build Status Documentation Status MIT Coverage

fake-py-django-storage is a Django storage integration for fake.py - a standalone, portable library designed for generating various random data types for testing.

Features

Prerequisites

Python 3.9+

Installation

pip install fake-py-django-storage

Documentation

Usage

FileSystemStorage of Django

from fake import FAKER
from fakepy.django_storage.filesystem import DjangoFileSystemStorage

STORAGE = DjangoFileSystemStorage(
    root_path="tmp",  # Optional
    rel_path="sub-tmp",  # Optional
)

pdf_file = FAKER.pdf_file(storage=STORAGE)

STORAGE.exists(pdf_file)

AWS S3 (using django-storages)

from fake import FAKER
from fakepy.django_storage.aws_s3 import DjangoAWSS3Storage

STORAGE = DjangoAWSS3Storage(
    root_path="tmp",  # Optional
    rel_path="sub-tmp",  # Optional
)

pdf_file = FAKER.pdf_file(storage=STORAGE)

STORAGE.exists(pdf_file)

Google Cloud Storage (using django-storages)

from fake import FAKER
from fakepy.django_storage.google_cloud_storage import (
    DjangoGoogleCloudStorage,
)

STORAGE = DjangoGoogleCloudStorage(
    root_path="tmp",  # Optional
    rel_path="sub-tmp",  # Optional
)

pdf_file = FAKER.pdf_file(storage=STORAGE)

STORAGE.exists(pdf_file)

Azure Cloud Storage (using django-storages)

from fake import FAKER
from fakepy.django_storage.azure_cloud_storage import (
    DjangoAzureCloudStorage,
)

STORAGE = DjangoAzureCloudStorage(
    root_path="tmp",  # Optional
    rel_path="sub-tmp",  # Optional
)

pdf_file = FAKER.pdf_file(storage=STORAGE)

STORAGE.exists(pdf_file)

Tests

pytest

Writing documentation

Keep the following hierarchy.

=====
title
=====

header
======

sub-header
----------

sub-sub-header
~~~~~~~~~~~~~~

sub-sub-sub-header
^^^^^^^^^^^^^^^^^^

sub-sub-sub-sub-header
++++++++++++++++++++++

sub-sub-sub-sub-sub-header
**************************

License

MIT

Support

For security issues contact me at the e-mail given in the Author section.

For overall issues, go to GitHub.

Author

Artur Barseghyan <artur.barseghyan@gmail.com>