• This repository has been archived on 28/Feb/2024
  • Stars
    star
    52
  • Rank 560,474 (Top 12 %)
  • Language
    Python
  • License
    MIT License
  • Created about 7 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Mimesis integration with factory_boy

mimesis_factory

test codecov PyPI version wemake-python-styleguide

Description

Mimesis integration for factory_boy.

Installation

pip install mimesis_factory

Usage

Look at the example below and you’ll understand how it works:

class Account(object):
    def __init__(self, username, email, name, surname, age):
        self.username = username
        self.email = email
        self.name = name
        self.surname = surname
        self.age = age

Now, use the MimesisField class from mimesis_factory to define how fake data is generated:

import factory
from mimesis_factory import MimesisField

from account import Account


class AccountFactory(factory.Factory):
    class Meta(object):
        model = Account

    username = MimesisField('username', template='l_d')
    name = MimesisField('name', gender='female')
    surname = MimesisField('surname', gender='female')
    age = MimesisField('age', minimum=18, maximum=90)
    email = factory.LazyAttribute(
        lambda instance: '{0}@example.org'.format(instance.username)
    )
    access_token = MimesisField('token', entropy=32)

pytest

We also recommend to use pytest-factoryboy. This way it will be possible to integrate your factories into pytest fixtures.

License

mimesis_factory is released under the MIT License.

More Repositories

1

awesomo

Cool open source projects. Choose your project and get involved in Open Source development now.
Go
9,351
star
2

mimesis

Mimesis is a robust data generator for Python that can produce a wide range of fake data in multiple languages.
Python
4,380
star
3

expynent

A library that provides regular expression patterns. If you hate to write regular expressions, then expynent can help you.
Python
385
star
4

secrets.clj

A library designed to generate cryptographically strong random numbers suitable for managing data such as passwords, account authentication, security tokens, and related secrets.
Clojure
66
star
5

nebula

Small library for colored (ANSI) output in Erlang/Elixir/LFE. It's can be useful when you need to create user-friendly command-line applications.
Erlang
53
star
6

macbook

A script for quickly setting up a development environment on the new Macbook.
Shell
48
star
7

rmanns

Remove annotations from the e-books downloaded from the pirate sites, such as www.it-ebooks.info, www.allitebooks.com and another ones.
Python
33
star
8

rkn-sosatb

Remove age verification system form PornHub for Russian users.
JavaScript
22
star
9

log4p

Log4j alternative for Python
Python
12
star
10

django-template

[WIP] A scaffold for all my Django projects.
Python
6
star
11

lk-geimfari.github.io

✍️ My personal blog, where I write my thoughts about software development etc.
CSS
5
star
12

spectet

Host availability monitoring utility that supports various protocols.
Go
3
star
13

mimety

Mimety is a tiny library for Elixir that help you handle mime types.
Elixir
2
star
14

tensorflow-censorship-categorization

2
star
15

parole

Simple and fast password manager based on gen_server and general balanced trees.
Erlang
1
star
16

hypeapp

Overhead shit that you don't need in your shitty project, but you have to use for hype.
1
star
17

gateway.tips

Gateway for crypto tip and donations.
Python
1
star
18

healthy

Service for showing statuses of your services.
1
star
19

Factorial

Factorial brings the 2FA to the convenience of your CLI.
1
star
20

snippets

1
star
21

NFTISTA

NFT art generator which makes it easy to generate a combinations of unique images.
Python
1
star
22

databank.clj

Simple in-memory database for Clojure.
Clojure
1
star