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
Ab testing - basically a statistical test in which two or more variants

Ab testing - basically a statistical test in which two or more variants

Buse Yıldırım 5 Mar 13, 2022
Mixer -- Is a fixtures replacement. Supported Django, Flask, SqlAlchemy and custom python objects.

The Mixer is a helper to generate instances of Django or SQLAlchemy models. It's useful for testing and fixture replacement. Fast and convenient test-

Kirill Klenov 871 Dec 25, 2022
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
Browser reload with uvicorn

uvicorn-browser This project is inspired by autoreload. Installation pip install uvicorn-browser Usage Run uvicorn-browser --help to see all options.

Marcelo Trylesinski 64 Dec 17, 2022
A set of pytest fixtures to test Flask applications

pytest-flask An extension of pytest test runner which provides a set of useful tools to simplify testing and development of the Flask extensions and a

pytest-dev 433 Dec 23, 2022
Automates hiketop+ crystal earning using python and appium

hikepy Works on poco x3 idk about your device deponds on resolution Prerquests Android sdk java adb Setup Go to https://appium.io/ Download and instal

4 Aug 26, 2022
Python package to easily work with selenium and manage tabs effectively.

Simple Selenium The aim of this package is to quickly get started with working with selenium for simple browser automation tasks. Installation Install

Vishal Kumar Mishra 1 Oct 27, 2021
reCaptchaBypasser For Bypass Any reCaptcha For Selenium Python

reCaptchaBypasser ' Usage : from selenium import webdriver from reCaptchaBypasser import reCaptchaScraper import time driver = webdriver.chrome(execu

Dr.Linux 8 Dec 17, 2022
Useful additions to Django's default TestCase

django-test-plus Useful additions to Django's default TestCase from REVSYS Rationale Let's face it, writing tests isn't always fun. Part of the reason

REVSYS 546 Dec 22, 2022
hCaptcha solver and bypasser for Python Selenium. Simple website to try to solve hCaptcha.

hCaptcha solver for Python Selenium. Many thanks to engageub for his hCaptcha solver userscript. This script is solely intended for the use of educati

Maxime Dréan 59 Dec 25, 2022
To automate the generation and validation tests of COSE/CBOR Codes and it's base45/2D Code representations

To automate the generation and validation tests of COSE/CBOR Codes and it's base45/2D Code representations, a lot of data has to be collected to ensure the variance of the tests. This respository was

160 Jul 25, 2022
This is a web test framework based on python+selenium

Basic thoughts for this framework There should have a BasePage.py to be the parent page and all the page object should inherit this class BasePage.py

Cactus 2 Mar 09, 2022
Testing Calculations in Python, using OOP (Object-Oriented Programming)

Testing Calculations in Python, using OOP (Object-Oriented Programming) Create environment with venv python3 -m venv venv Activate environment . venv

William Koller 1 Nov 11, 2021
AutoExploitSwagger is an automated API security testing exploit tool that can be combined with xray, BurpSuite and other scanners.

AutoExploitSwagger is an automated API security testing exploit tool that can be combined with xray, BurpSuite and other scanners.

6 Jan 28, 2022
A wrapper for webdriver that is a jumping off point for web automation.

Webdriver Automation Plus ===================================== Description: Tests the user can save messages then find them in search and Saved items

1 Nov 08, 2021
Subprocesses for Humans 2.0.

Delegator.py — Subprocesses for Humans 2.0 Delegator.py is a simple library for dealing with subprocesses, inspired by both envoy and pexpect (in fact

Amit Tripathi 1.6k Jan 04, 2023
A single module to link Python ecosystem to the Web

A single module to link Python ecosystem to the Web. Have a quick look at the Gallery first to get convinced ! FAQ For any questions, please use Stack

66 Dec 21, 2022
Donors data of Tamil Nadu Chief Ministers Relief Fund scrapped from https://ereceipt.tn.gov.in/cmprf/Interface/CMPRF/MonthWiseReport

Tamil Nadu Chief Minister's Relief Fund Donors Scrapped data from https://ereceipt.tn.gov.in/cmprf/Interface/CMPRF/MonthWiseReport Scrapper scrapper.p

Arunmozhi 5 May 18, 2021
Python selenium script to bypass simaster.ugm.ac.id weak captcha.

Python selenium script to bypass simaster.ugm.ac.id weak "captcha".

Hafidh R K 1 Feb 01, 2022