# Path: app/forms.py
# class AddBookForm(forms.Form):
#     bookname = forms.CharField(max_length=150)
#     author = forms.CharField(max_length=100)
#     category = forms.CharField(max_length=30)
#     language = forms.CharField(max_length=30)
#     about = forms.CharField(widget=forms.Textarea)
#     bookfile = forms.FileField(validators=[validate_pdf])
#     private = forms.BooleanField(required=False)
# 
# Path: app/models.py
# class TheUser(models.Model):
# class Category(models.Model):
# class Author(models.Model):
# class Language(models.Model):
# class Book(models.Model):
# class BookRating(models.Model):
# class BookComment(models.Model):
# class AddedBook(models.Model):
# class Post(models.Model):
# class SupportMessage(models.Model):
#     REMINDER_TEMPLATE = json.dumps({
#         "common": {
#             "fb_page": True,
#             "fb_group": True,
#             "twitter": True,
#             "vk": True,
#             "disabled_all": False
#         },
#         "api": {
#             "app_rate": True
#         },
#         "web": {
#             "app_download": True,
#         },
#     })
#     def __str__(self):
#     def get_api_reminders(self):
#     def get_web_reminders(self):
#     def update_reminder(self, field, value):
#     def __str__(self):
#     def __str__(self):
#     def get_authors_list(author_part, do_escape=False):
#     def __str__(self):
#     def __str__(self):
#     def get_related_objects_for_create(user_id, book_form):
#     def get_related_objects_create_api(user, data):
#     def get_related_objects_selected_book(user, book_id, user_key=''):
#     def sort_by_book_name(user, category):
#     def sort_by_author(user, category):
#     def sort_by_estimation(user, category):
#     def sort_by_readable(user, category=None, count=9):
#     def generate_books(filtered_books):
#     def fetch_books(search_data):
#     def generate_existing_books(book_part):
#     def exclude_private_books(user, books):
#     def get_user_added_books(user):
#     def get_count_added(book_id):
# 
# Path: app/tests/utils.py
# class Utils:
#     """
#     Class with util functions which helps to generate some data.
#     """
# 
#     # ------------------------------------------------------------------------------------------------------------------
#     @staticmethod
#     def generate_sort_dict(book):
#         return {
#             'id': book.id,
#             'name': escape(book.book_name),
#             'author': escape(book.id_author.author_name),
#             'url': book.photo.url if book.photo else '',
#             'upload_date': book.upload_date.strftime('%d-%m-%Y')
#         }


import copy
import os
from django.contrib import auth
from django.contrib.auth.models import User
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db.models import QuerySet
from django.test import TestCase, Client, mock
from django.urls import reverse
from ..forms import AddBookForm
from ..models import (TheUser, Category, Author, Language, Book,
                      AddedBook, BookRating, BookComment, Post, SupportMessage, BookRelatedData)
from .utils import Utils

        for book in books_setup:
            Book.objects.create(
                book_name=book['name'],
                id_author=book['author'],
                id_category=book['category'],
                description='TEST description',
                language=book['language'],
                book_file=book['file'],
                photo=book.get('photo', False),
                who_added=book['who_added'],
                private_book=book.get('private', False),
                blocked_book=book.get('blocked_book', False)
            )

    # ------------------------------------------------------------------------------------------------------------------
    @classmethod
    def setup_added_books(cls):
        AddedBook.objects.create(id_user=cls.the_user1, id_book=Book.objects.get(book_name='Third Book'))
        AddedBook.objects.create(id_user=cls.the_user1, id_book=Book.objects.get(book_name='Sixth Book'))
        AddedBook.objects.create(id_user=cls.the_user1, id_book=Book.objects.get(book_name='Fourth Book'))
        AddedBook.objects.create(id_user=cls.the_user2, id_book=Book.objects.get(book_name='Third Book'))
        AddedBook.objects.create(id_user=cls.the_user2, id_book=Book.objects.get(book_name='Sixth Book'))
        AddedBook.objects.create(id_user=cls.the_user2, id_book=Book.objects.get(book_name='Second Book'))
        AddedBook.objects.create(id_user=cls.the_user5, id_book=Book.objects.get(book_name='Sixth Book'))
        AddedBook.objects.create(id_user=cls.the_user6, id_book=Book.objects.get(book_name='Sixth Book'))

    # ------------------------------------------------------------------------------------------------------------------
    @classmethod
    def setup_book_rating(cls):

# Path: app/forms.py
# class AddBookForm(forms.Form):
#     bookname = forms.CharField(max_length=150)
#     author = forms.CharField(max_length=100)
#     category = forms.CharField(max_length=30)
#     language = forms.CharField(max_length=30)
#     about = forms.CharField(widget=forms.Textarea)
#     bookfile = forms.FileField(validators=[validate_pdf])
#     private = forms.BooleanField(required=False)
# 
# Path: app/models.py
# class TheUser(models.Model):
# class Category(models.Model):
# class Author(models.Model):
# class Language(models.Model):
# class Book(models.Model):
# class BookRating(models.Model):
# class BookComment(models.Model):
# class AddedBook(models.Model):
# class Post(models.Model):
# class SupportMessage(models.Model):
#     REMINDER_TEMPLATE = json.dumps({
#         "common": {
#             "fb_page": True,
#             "fb_group": True,
#             "twitter": True,
#             "vk": True,
#             "disabled_all": False
#         },
#         "api": {
#             "app_rate": True
#         },
#         "web": {
#             "app_download": True,
#         },
#     })
#     def __str__(self):
#     def get_api_reminders(self):
#     def get_web_reminders(self):
#     def update_reminder(self, field, value):
#     def __str__(self):
#     def __str__(self):
#     def get_authors_list(author_part, do_escape=False):
#     def __str__(self):
#     def __str__(self):
#     def get_related_objects_for_create(user_id, book_form):
#     def get_related_objects_create_api(user, data):
#     def get_related_objects_selected_book(user, book_id, user_key=''):
#     def sort_by_book_name(user, category):
#     def sort_by_author(user, category):
#     def sort_by_estimation(user, category):
#     def sort_by_readable(user, category=None, count=9):
#     def generate_books(filtered_books):
#     def fetch_books(search_data):
#     def generate_existing_books(book_part):
#     def exclude_private_books(user, books):
#     def get_user_added_books(user):
#     def get_count_added(book_id):
# 
# Path: app/tests/utils.py
# class Utils:
#     """
#     Class with util functions which helps to generate some data.
#     """
# 
#     # ------------------------------------------------------------------------------------------------------------------
#     @staticmethod
#     def generate_sort_dict(book):
#         return {
#             'id': book.id,
#             'name': escape(book.book_name),
#             'author': escape(book.id_author.author_name),
#             'url': book.photo.url if book.photo else '',
#             'upload_date': book.upload_date.strftime('%d-%m-%Y')
#         }


# Path: app/tests/test_models.py
import copy
import os
from django.contrib import auth
from django.contrib.auth.models import User
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db.models import QuerySet
from django.test import TestCase, Client, mock
from django.urls import reverse
from ..forms import AddBookForm
from ..models import (TheUser, Category, Author, Language, Book,
                      AddedBook, BookRating, BookComment, Post, SupportMessage, BookRelatedData)
from .utils import Utils


        for book in books_setup:
            Book.objects.create(
                book_name=book['name'],
                id_author=book['author'],
                id_category=book['category'],
                description='TEST description',
                language=book['language'],
                book_file=book['file'],
                photo=book.get('photo', False),
                who_added=book['who_added'],
                private_book=book.get('private', False),
                blocked_book=book.get('blocked_book', False)
            )

    # ------------------------------------------------------------------------------------------------------------------
    @classmethod
    def setup_added_books(cls):
        AddedBook.objects.create(id_user=cls.the_user1, id_book=Book.objects.get(book_name='Third Book'))
        AddedBook.objects.create(id_user=cls.the_user1, id_book=Book.objects.get(book_name='Sixth Book'))
        AddedBook.objects.create(id_user=cls.the_user1, id_book=Book.objects.get(book_name='Fourth Book'))
        AddedBook.objects.create(id_user=cls.the_user2, id_book=Book.objects.get(book_name='Third Book'))
        AddedBook.objects.create(id_user=cls.the_user2, id_book=Book.objects.get(book_name='Sixth Book'))
        AddedBook.objects.create(id_user=cls.the_user2, id_book=Book.objects.get(book_name='Second Book'))
        AddedBook.objects.create(id_user=cls.the_user5, id_book=Book.objects.get(book_name='Sixth Book'))
        AddedBook.objects.create(id_user=cls.the_user6, id_book=Book.objects.get(book_name='Sixth Book'))

    # ------------------------------------------------------------------------------------------------------------------
    @classmethod
    def setup_book_rating(cls):

        BookRating.objects.create(id_book=Book.objects.get(book_name='Third Book'), id_user=cls.the_user1, rating=10)