phone_countryContactLocale Aware

Mock Jutsu HOW-TO | UK

The phone_country function within the mock-jutsu library is a specialised utility designed to generate realistic international telephone country dialling codes. As a core component of the "Contact" category, this function is essential for developers who need to populate databases or simulate API responses with accurate global prefixes. Whether you are building a user registration form or a complex telecommunications routing engine, using the phone_country generator ensures that your mock data reflects the complexity of international numbering plans without the manual effort of sourcing real-world codes.

Adhering to the ITU-T E.164 international public telecommunication numbering plan, mock-jutsu ensures that each generated code follows the standard format. This typically includes the mandatory plus sign (+) prefix followed by a numeric sequence ranging from one to three digits, such as +44 for the United Kingdom or +90 for Turkey. By utilising these established standards, the library provides high-quality test data that remains consistent across different environments. Developers can invoke this functionality via a simple Python command using jutsu.generate('phone_country'), through the command-line interface with mockjutsu generate phone_country, or even within JMeter scripts for load testing using the ${__mockjutsu(phone_country,)} syntax.

Incorporating phone_country into your development workflow offers significant advantages, particularly during the testing phases of globalised applications. It is particularly useful for validating front-end input masks, testing backend SMS gateway integrations, and ensuring that internationalisation logic correctly identifies a user's region based on their dialling code. By automating the production of this mock data, teams can avoid the pitfalls of hardcoded values and improve the robustness of their validation logic. This level of automation reduces the risk of edge-case failures when an application is deployed to a diverse, international user base.

Ultimately, the mock-jutsu library streamlines the process of generating synthetic contact information, making it an indispensable asset for modern software engineering. The phone_country function specifically bridges the gap between simple string generation and structured, standards-compliant data. By leveraging this tool, developers can focus on core feature development while maintaining confidence that their test data is both realistic and reliable. This efficiency not only speeds up the development lifecycle but also ensures that international communication features are thoroughly vetted before reaching production.

CLI Usage
mockjutsu generate phone_country --locale TRmockjutsu generate phone_country --locale DEmockjutsu bulk phone_country --count 10 --locale TRmockjutsu export phone_country --count 10 --format json --locale TRmockjutsu export phone_country --count 10 --format csv --locale TRmockjutsu export phone_country --count 10 --format sql --locale TR# --mask: regulation-compliant output (PCI DSS / GDPR / KVKK)mockjutsu generate phone_country --locale TR --maskmockjutsu bulk phone_country --count 5 --locale TR --mask
Python API
from mockjutsu import jutsujutsu.generate('phone_country', locale='TR')jutsu.bulk('phone_country', count=10, locale='TR')jutsu.template(['phone_country'], count=5, locale='TR')# mask=True: regulation-compliant outputjutsu.generate('phone_country', locale='TR', mask=True)jutsu.bulk('phone_country', count=5, locale='TR', mask=True)
JMeter
${__mockjutsu_comm(phone_country,TR)}# JMeter Function: __mockjutsu_comm# Parameter 1: phone_country# Parameter 2: locale (TR/UK/US/DE/FR/RU)${__mockjutsu_comm(phone_country,DE)}# Add 'mask' keyword to get a regulation-compliant masked value${__mockjutsu_comm(phone_country,TR,mask)}
REST API
GET /generate/phone_country?locale=TR# → {"type":"phone_country","result":"...","status":"ok"}GET /bulk/phone_country?count=10&locale=TRPOST /template {"types":["phone_country"],"count":1,"locale":"TR"}# mask=true: regulation-compliant outputGET /generate/phone_country?locale=TR&mask=trueGET /bulk/phone_country?count=5&locale=TR&mask=true

Parameters

Parameter Values Description
--locale TR|UK|US|DE|FR|RU Region / locale for locale-aware output
--mask true | false Return a regulation-compliant masked value (PCI DSS, GDPR, KVKK…)

Other Languages