The expiry function within the mock-jutsu library is a specialized financial utility designed to generate realistic credit and debit card expiration dates. By producing strings in the standard "MM/YY" format, this tool allows developers to populate payment forms and transaction schemas with high-fidelity mock data. Every date generated by this function is mathematically guaranteed to be in the future relative to the execution time, ensuring that your automated tests do not fail prematurely due to expired credentials. Whether you are building a subscription management system or a standard e-commerce checkout, having access to consistent test data is essential for maintaining application integrity.
To maintain technical accuracy and mimic real-world banking systems, mock-jutsu follows industry standards for financial data representation. The algorithm behind the expiry function calculates a random month from 01 to 12 and pairs it with a year typically ranging from one to five years beyond the current system clock. This approach ensures that the test data mirrors the lifecycle of actual issued cards. By using jutsu.generate('expiry') in your Python scripts or the mockjutsu generate expiry command in your terminal, you can instantly inject valid-looking expiration dates into your development environment without the security risk of using real customer information.
Testing scenarios for the expiry function are diverse, ranging from front-end validation logic to back-end payment gateway simulations. Quality assurance engineers can leverage this function within performance testing tools like JMeter using the ${__mockjutsu(expiry,)} syntax to conduct load testing on financial APIs. It is particularly useful for verifying that your system correctly handles various future dates, including year-end transitions and leap years. By automating the creation of these dates, mock-jutsu eliminates the manual overhead of updating hardcoded strings in your test suites as time progresses and years pass.
The primary benefit of using mock-jutsu for generating an expiry date is the significant reduction in friction during the software development lifecycle. Instead of manually calculating future dates for every test run, developers can rely on a programmatic solution that integrates seamlessly into CI/CD pipelines. This consistency helps in identifying edge cases in date parsing logic and ensures that your database seeding scripts remain robust over time. Ultimately, the expiry function provides a reliable, scalable way to manage financial mock data, allowing your team to focus on building core features rather than formatting strings.
mockjutsu generate expirymockjutsu bulk expiry --count 10mockjutsu export expiry --count 10 --format jsonmockjutsu export expiry --count 10 --format csvmockjutsu export expiry --count 10 --format sql# --mask: regulation-compliant output (PCI DSS / GDPR / KVKK)mockjutsu generate expiry --maskmockjutsu bulk expiry --count 5 --maskfrom mockjutsu import jutsujutsu.generate('expiry')jutsu.bulk('expiry', count=10)jutsu.template(['expiry'], count=5)# mask=True: regulation-compliant outputjutsu.generate('expiry', mask=True)jutsu.bulk('expiry', count=5, mask=True)${__mockjutsu_financial(expiry)}# JMeter Function: __mockjutsu_financial# Parameter 1: expiry# Parameter 2: (not required for this function)# Add 'mask' keyword to get a regulation-compliant masked value${__mockjutsu_financial(expiry,mask)}GET /generate/expiry# → {"type":"expiry","result":"...","status":"ok"}GET /bulk/expiry?count=10POST /template {"types":["expiry"],"count":1}# mask=true: regulation-compliant outputGET /generate/expiry?mask=trueGET /bulk/expiry?count=5&mask=true| Parameter | Values | Description |
|---|---|---|
| --mask | true | false | Return a regulation-compliant masked value (PCI DSS, GDPR, KVKK…) |