Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
pytest-mimesis is a pytest plugin that provides pytest fixtures for Mimesis providers. This allows you to quickly and easily use randomized, dummy data as part of your test suite.
pip install pytest-mimesis
Using the personal provider as part of a test.
# your_module/__init__.py
def validate_email(email):
# code that validates an e-mail address
return True
And your test file:
# tests/test_email.py
from your_module import validate_email
def test_validate_email(mimesis):
assert validate_email(mimesis('email'))
You can also specify locales:
@pytest.mark.parameterize('mimesis_locale', ['de']) # use German locale
def test_create_user(mimesis):
assert create_user(name=mimesis('full_name'))
@pytest.mark.parameterize('mimesis_locale', ['de', 'en', 'jp']) # test multiple locales
def test_add_phone(user, mimesis):
assert user.add_phone_number(name=mimesis('full_name'))
We provide two public fixtures: mimesis_locale
and mimesis
.
While mimesis_locale
is just a string (like: en
, ru
),
mimesis
is an instance of mimesis.schema.Field
.
We use caching of mimesis
instances for different locales for the whole
test session, so creating new instances is cheap.
You might also be interested in:
factory_boy
integration to mimesis
pytest-mimesis is licensed under the MIT License.
FAQs
Mimesis integration with the pytest test runner
We found that pytest-mimesis demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.