FauxFactory generates random data for your automated tests easily!

Related tags

Testingfauxfactory
Overview

FauxFactory

Build Status Python Compatibility Current Version Download Statistics Test Coverage License

FauxFactory generates random data for your automated tests easily!

There are times when you're writing tests for your application when you need to pass random, non-specific data to the areas you are testing. For these scenarios when all you need is a random string, numbers, dates, times, email address, IP, etc, then FauxFactory can help!

The full documentation is available on ReadTheDocs. It can also be generated locally:

pip install -r requirements-optional.txt
make docs-html
Comments
  • Add python-2.6 support

    Add python-2.6 support

    Support python-2.6

    • Adds a tox.ini to facilitate testing supported py_versions
    • Add a requirements-optional-26.txt file
    • Update fauxfactory/init.py to support 2.6 syntax
    • updates tests/test_*.py to conditionally import unittest2
    • Add 2.6 to .travis.yml
    opened by jlaska 22
  • Enable passing a prefix for IP addresses

    Enable passing a prefix for IP addresses

    I hope tests say all, intended to replace https://github.com/RedHatQE/cfme_tests/blob/master/utils/randomness.py#L5

    btw. what's wrong on map(str, prefix_ipv4 or []) ? Shorter than the list comprehension :smile:

    opened by mfalesni 12
  • gen_integer() change

    gen_integer() change

    Using Win64 Python2.7, sys.maxsize returns a long and the isinstance(maxsize, int) test fails. I updated this to a tuple to consider the differences with Python3 (which doesn't really use long()) by adding an integer types tuple (int, long,) depending on the platform.

    opened by apense 12
  • Add unicode letters generator

    Add unicode letters generator

    This generator is a helper for the gen_utf8 function which will provide the system supported list of unicode letters. This will avoid generating unicode string with control characters and other non letters characters.

    Also adds tests for the generator in order to ensure it is not generating unwanted characters.

    Closes #69

    opened by elyezer 11
  • Add valid netmask random generator

    Add valid netmask random generator

    I was motivated to create this because this regex used to validate netmasks https://github.com/theforeman/foreman/blob/develop/lib/net/validations.rb#L8.

    Also got some info at http://www.iplocation.net/tools/netmask.php.

    opened by elyezer 11
  • allow zero-length strings

    allow zero-length strings

    Methods like generate_alphanumeric and generate_alpha allow the user to choose how long the resultant string should be. Each of those string generation methods checks length to ensure that the value is an integer and is not too short. There are two problems here:'

    1. A length of zero is not allowed. That doesn't make sense. A user should be able to generate a zero-length string if they so desire.
    2. The validation logic in each method is identical. It should be refactored out into a single private method.
    opened by Ichimonji10 10
  • don't install tests into the binary distribution

    don't install tests into the binary distribution

    this tries to install a "tests" python package, which we don't own. at the same time, also exclude docs and contrib as done in the PyPA sample project [1]

    [1] https://github.com/pypa/sampleproject/blob/master/setup.py

    opened by evgeni 9
  • Added a method gen_vm_mac() to generate valid mac for QEMU/KVM virtual machines

    Added a method gen_vm_mac() to generate valid mac for QEMU/KVM virtual machines

    For discovery feature, I need a valid mac that I can use for VM provisioning. However the current gen_mac() doesn't generate a valid mac for VM's on QEMU/KVM. The mac address must start with sequence: 54:52:00 otherwise VM creation fails with error:

    ERROR XML error: expected unicast mac address, found multicast '63:8e:b3:53:77:b1'

    So I added a new method to generate vm mac. gen_vm_mac(). We can update existing one too if that's the best option ?

    opened by sghai 9
  • Introduce formatted string generator

    Introduce formatted string generator

    Introduce fauxfactory.generate() which takes a string with formatting similar to "".format() but instead of inserting strings, it randomizes the values based on what is located inside the braces.

    opened by mfalesni 9
  • [DONOTMERGE] Simplified ``FauxFactory`` class definition.

    [DONOTMERGE] Simplified ``FauxFactory`` class definition.

    This pull requests proposes to simplify the definition of the FauxFactory class for backwards compatibility by looking into the module's own set of functions and individually adding them to the class using setaatr, and removing a long list of function definitions that were calling the newer set of functions.

    opened by omaciel 9
  • incompatible with Python 3

    incompatible with Python 3

    Fauxfactory appears to be incompatible with Python 3.

    Why do I say this? When executing one of the example lines of code displayed in the readme (FauxFactory.generate_alphanumeric()), I get an error stating name 'unicode' is not defined. This is probably because the application assumes that it is being run under Python 2. However, unicode support has been more fully integrated in Python 3, and the "unicode" function has been removed from the standard library.

    Here's some copy-pasta from my machine:

    Python 3.4.0 (default, Mar 17 2014, 23:20:09)·                                                                        
    [GCC 4.8.2 20140206 (prerelease)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from fauxfactory import FauxFactory
    >>> FauxFactory.generate_alphanumeric()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.4/site-packages/fauxfactory/__init__.py", line 102, in generate_alphanumeric
        return unicode(output_string)
    NameError: name 'unicode' is not defined
    
    opened by Ichimonji10 8
  • generic method for all different types of unicode string gens

    generic method for all different types of unicode string gens

    We already have gen_cjk() and per pull #63 might have gen_cyrillic.

    If we wanted to, in the future, support other methods (Tamil, Telugu, etc.), we can see where this would get very cumbersome/duplicitous, very quickly.

    It might be good to have some generic function that takes any specific range and plugs it in, and then wrap that with a function specific to the unicode block you want to test.

    e.g., instead of

         codepoints = [random.randint(0x4E00, 0x9FCC) for _ in range(length)]
         try:
             # (undefined-variable) pylint:disable=E0602
             output = u''.join(unichr(codepoint) for codepoint in codepoints)
         except NameError:
             output = u''.join(chr(codepoint) for codepoint in codepoints)
         return _make_unicode(output)
    

    ...put this into a generate_unicode_range() function that can have codepoint values passed to it, and then use that inside a function for any desired unicode block...

    gen_bengali() gen_hebrew() gen_hiragana()

    Now, there is a sticky wicket in all this. Some character sets span multiple, non contiguous blocks. More details here:

    http://en.wikipedia.org/wiki/Unicode_block

    So really, we should be able to pass all desired blocks into a python list, and then either make a single range to rule them all, or simply the ability to choose a random character out of each block within the list.

    opened by cswiii 3
  • `generate_email` uses production domains

    `generate_email` uses production domains

    As described in RFC 2606, the IETF has reserved several domains for use within documentation and example code. The following top-level domains are reserved:

    • test
    • example
    • invalid
    • localhost

    Additionally, the following second-level domains are reserved:

    • example.com
    • example.net
    • example.org

    Method FauxFactory.generate_email should, by default, use these IETF-sanctioned domains.

    opened by Ichimonji10 3
Releases(v3.1.0)
Owner
Og Maciel
I'm the linchpin for a diverse team of Quality Engineers, solving problems that people haven’t predicted, seeing things people haven’t seen, connecting people.
Og Maciel
An interactive TLS-capable intercepting HTTP proxy for penetration testers and software developers.

mitmproxy mitmproxy is an interactive, SSL/TLS-capable intercepting proxy with a console interface for HTTP/1, HTTP/2, and WebSockets. mitmdump is the

mitmproxy 29.7k Jan 02, 2023
A collection of testing examples using pytest and many other libreris

Effective testing with Python This project was created for PyConEs 2021 Check out the test samples at tests Check out the slides at slides (markdown o

Héctor Canto 10 Oct 23, 2022
Fidelipy - Semi-automated trading on fidelity.com

fidelipy fidelipy is a simple Python 3.7+ library for semi-automated trading on fidelity.com. The scope is limited to the Trade Stocks/ETFs simplified

Darik Harter 8 May 10, 2022
Python Webscraping using Selenium

Web Scraping with Python and Selenium The code shows how to do web scraping using Python and Selenium. We use as data the https://sbot.org.br/localize

Luís Miguel Massih Pereira 1 Dec 01, 2021
A modern API testing tool for web applications built with Open API and GraphQL specifications.

Schemathesis Schemathesis is a modern API testing tool for web applications built with Open API and GraphQL specifications. It reads the application s

Schemathesis.io 1.6k Jan 06, 2023
A twitter bot that simply replies with a beautiful screenshot of the tweet, powered by poet.so

Poet this! Replies with a beautiful screenshot of the tweet, powered by poet.so Installation git clone https://github.com/dhravya/poet-this.git cd po

Dhravya Shah 30 Dec 04, 2022
A Simple Unit Test Matcher Library for Python 3

pychoir - Python Test Matchers for humans Super duper low cognitive overhead matching for Python developers reading or writing tests. Implemented in p

Antti Kajander 15 Sep 14, 2022
Django-google-optimize is a Django application designed to make running server side Google Optimize A/B tests easy.

Django-google-optimize Django-google-optimize is a Django application designed to make running Google Optimize A/B tests easy. Here is a tutorial on t

Adin Hodovic 39 Oct 25, 2022
자동 건강상태 자가진단 메크로 서버전용

Auto-Self-Diagnosis-for-server 자동 자가진단 메크로 서버전용 이 프로그램은 SaidBySolo님의 auto-self-diagnosis를 참고하여 제작하였습니다. 개인 사용 목적으로 제작하였기 때문에 추후 업데이트는 진행하지 않습니다. 의존성 G

JJooni 3 Dec 04, 2021
pytest splinter and selenium integration for anyone interested in browser interaction in tests

Splinter plugin for the pytest runner Install pytest-splinter pip install pytest-splinter Features The plugin provides a set of fixtures to use splin

pytest-dev 238 Nov 14, 2022
Python Moonlight (Machine Learning) Practice

PyML Python Moonlight (Machine Learning) Practice Contents Design Documentation Prerequisites Checklist Dev Setup Testing Run Prerequisites Python 3 P

Dockerian Seattle 2 Dec 25, 2022
Baseball Discord bot that can post up-to-date scores, lineups, and home runs.

Sunny Day Discord Bot Baseball Discord bot that can post up-to-date scores, lineups, and home runs. Uses webscraping techniques to scrape baseball dat

Benjamin Hammack 1 Jun 20, 2022
Fully functioning price detector built with selenium and python

Fully functioning price detector built with selenium and python

mark sikaundi 4 Mar 30, 2022
a socket mock framework - for all kinds of socket animals, web-clients included

mocket /mɔˈkɛt/ A socket mock framework for all kinds of socket animals, web-clients included - with gevent/asyncio/SSL support ...and then MicroPytho

Giorgio Salluzzo 249 Dec 14, 2022
Mypy static type checker plugin for Pytest

pytest-mypy Mypy static type checker plugin for pytest Features Runs the mypy static type checker on your source files as part of your pytest test run

Dan Bader 218 Jan 03, 2023
A suite of benchmarks for CPU and GPU performance of the most popular high-performance libraries for Python :rocket:

A suite of benchmarks for CPU and GPU performance of the most popular high-performance libraries for Python :rocket:

Dion Häfner 255 Jan 04, 2023
Rerun pytest when your code changes

A simple watcher for pytest Overview pytest-watcher is a tool to automatically rerun pytest when your code changes. It looks for the following events:

Olzhas Arystanov 74 Dec 29, 2022
Repository for JIDA SNP Browser Web Application: Local Deployment

JIDA JIDA is a web application that retrieves SNP information for a genomic region of interest in Homo sapiens and calculates specific summary statist

3 Mar 03, 2022
This file will contain a series of Python functions that use the Selenium library to search for elements in a web page while logging everything into a file

element_search with Selenium (Now With docstrings 😎 ) Just to mention, I'm a beginner to all this, so it it's very possible to make some mistakes The

2 Aug 12, 2021
Getting the most out of your hobby servo

ServoProject by Adam Bäckström Getting the most out of your hobby servo Theory The control system of a regular hobby servo looks something like this:

209 Dec 20, 2022