gold eggs backend
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
This commit is contained in:
1
core/http/database/factory/__init__.py
Executable file
1
core/http/database/factory/__init__.py
Executable file
@@ -0,0 +1 @@
|
||||
from .core import * # noqa
|
||||
31
core/http/database/factory/core.py
Executable file
31
core/http/database/factory/core.py
Executable file
@@ -0,0 +1,31 @@
|
||||
"""
|
||||
Create a new fake User/Post
|
||||
"""
|
||||
|
||||
from core.http import models
|
||||
from core.utils import factory
|
||||
|
||||
|
||||
class UserFactory(factory.BaseFaker):
|
||||
model = models.User
|
||||
|
||||
def handle(self):
|
||||
"""
|
||||
Factory method
|
||||
"""
|
||||
return {
|
||||
"first_name": self.faker.first_name(),
|
||||
"username": self.faker.user_name(),
|
||||
"phone": self.faker.phone_number(),
|
||||
}
|
||||
|
||||
|
||||
class PostFactory(factory.BaseFaker):
|
||||
model = models.Post
|
||||
|
||||
def handle(self):
|
||||
return {
|
||||
"title": self.faker.name(),
|
||||
"desc": self.faker.text(),
|
||||
"image": self.faker.image_url(),
|
||||
}
|
||||
Reference in New Issue
Block a user