Permalink
Browse files

Step 1 - Testing the endpoints

  • Loading branch information...
lgiordani committed Jul 15, 2017
1 parent a650cb4 commit 27a1d8ccd5b0a57fa6d9d5f3bd80874538f14ed2
Showing with 53 additions and 0 deletions.
  1. +53 −0 tests/test_datastats.py
View
@@ -0,0 +1,53 @@
import json
from datastats.datastats import DataStats
def test_json():
test_data = [
{
"id": 1,
"name": "Laith",
"surname": "Simmons",
"age": 68,
"salary": "£27888"
},
{
"id": 2,
"name": "Mikayla",
"surname": "Henry",
"age": 49,
"salary": "£67137"
},
{
"id": 3,
"name": "Garth",
"surname": "Fields",
"age": 70,
"salary": "£70472"
}
]
ds = DataStats()
assert ds.stats(test_data, 20, 20000) == json.dumps(
{
'avg_age': 62,
'avg_salary': 55165,
'avg_yearly_increase': 837,
'max_salary': [{
"id": 3,
"name": "Garth",
"surname": "Fields",
"age": 70,
"salary": "£70472"
}],
'min_salary': [{
"id": 1,
"name": "Laith",
"surname": "Simmons",
"age": 68,
"salary": "£27888"
}]
}
)

0 comments on commit 27a1d8c

Please sign in to comment.