Some samples for testing

This commit is contained in:
Endre Karlson 2013-02-13 19:17:57 +01:00
parent b066a950e6
commit 711f9501d2
7 changed files with 73 additions and 0 deletions

28
billingstack/samples.py Normal file
View 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

View File

@ -0,0 +1,9 @@
[
{
"address1": "Superstreet 10",
"city": "SomeCity",
"state": "State X",
"country": "SomeCountry",
"company": "Company X"
}
]

View File

@ -0,0 +1,8 @@
[
{
"letter": "nok"
},
{
"letter": "sek"
}
]

View File

@ -0,0 +1,5 @@
[
{
"name": "Customer X"
}
]

View File

@ -0,0 +1,8 @@
[
{
"letter": "nor"
},
{
"letter": "swe"
}
]

View File

@ -0,0 +1,9 @@
[
{
"address1": "Superstreet 10",
"city": "SomeCity",
"state": "State X",
"country": "SomeCountry",
"company": "Company X"
}
]

View File

@ -0,0 +1,6 @@
[
{
"username": "demo",
"password": "secret"
}
]