Some samples for testing
This commit is contained in:
parent
b066a950e6
commit
711f9501d2
28
billingstack/samples.py
Normal file
28
billingstack/samples.py
Normal file
@ -0,0 +1,28 @@
|
||||
import glob
|
||||
import os.path
|
||||
|
||||
import anyjson as json
|
||||
|
||||
|
||||
DIR = os.path.join(os.path.dirname(__file__), 'samples_data')
|
||||
|
||||
|
||||
def get_sample(name):
|
||||
"""
|
||||
Get a sample file .json, for example user.json
|
||||
|
||||
:param name: The name of the sample type
|
||||
"""
|
||||
f = open('%s/%s.json' % (DIR, name))
|
||||
return json.loads(f.read())
|
||||
|
||||
|
||||
def get_samples():
|
||||
"""
|
||||
Read the samples and return it as a dict where the filename is the key
|
||||
"""
|
||||
samples = {}
|
||||
for f in glob.glob(DIR + '/*.json'):
|
||||
name = os.path.basename(f)[:-(len(".json"))]
|
||||
samples[name] = get_sample(name)
|
||||
return samples
|
9
billingstack/samples_data/contact_info.json
Normal file
9
billingstack/samples_data/contact_info.json
Normal file
@ -0,0 +1,9 @@
|
||||
[
|
||||
{
|
||||
"address1": "Superstreet 10",
|
||||
"city": "SomeCity",
|
||||
"state": "State X",
|
||||
"country": "SomeCountry",
|
||||
"company": "Company X"
|
||||
}
|
||||
]
|
8
billingstack/samples_data/currency.json
Normal file
8
billingstack/samples_data/currency.json
Normal file
@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"letter": "nok"
|
||||
},
|
||||
{
|
||||
"letter": "sek"
|
||||
}
|
||||
]
|
5
billingstack/samples_data/customer.json
Normal file
5
billingstack/samples_data/customer.json
Normal file
@ -0,0 +1,5 @@
|
||||
[
|
||||
{
|
||||
"name": "Customer X"
|
||||
}
|
||||
]
|
8
billingstack/samples_data/language.json
Normal file
8
billingstack/samples_data/language.json
Normal file
@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"letter": "nor"
|
||||
},
|
||||
{
|
||||
"letter": "swe"
|
||||
}
|
||||
]
|
9
billingstack/samples_data/merchant.json
Normal file
9
billingstack/samples_data/merchant.json
Normal file
@ -0,0 +1,9 @@
|
||||
[
|
||||
{
|
||||
"address1": "Superstreet 10",
|
||||
"city": "SomeCity",
|
||||
"state": "State X",
|
||||
"country": "SomeCountry",
|
||||
"company": "Company X"
|
||||
}
|
||||
]
|
6
billingstack/samples_data/user.json
Normal file
6
billingstack/samples_data/user.json
Normal file
@ -0,0 +1,6 @@
|
||||
[
|
||||
{
|
||||
"username": "demo",
|
||||
"password": "secret"
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user