import json

import requests

URL = ("http://", "127.0.0.1", ":", "8000", "/")


def test_empty_user_list():
    r = requests.get(''.join(URL + ('user', )))
    assert r.status_code == 200
    assert r.headers['Content-Type'] == 'application/json'
    users = json.loads(r.text)
    assert {'overall_count', 'limit', 'offset', 'entries'}.issubset(users)
    assert users['overall_count'] == 0
    assert users['limit'] == 100
    assert users['offset'] == 0
    assert users['entries'] == []


def test_user_not_found():
    r = requests.get(''.join(URL + ('user', '/', '10')))
    assert r.status_code == 404
    assert r.headers['Content-Type'] == 'application/json'
    result = json.loads(r.text)
    assert 'message' in result
    assert result['message'] == "user 10 not found"


def test_user_not_found_transactions():
    r = requests.get(''.join(URL + ('user', '/', '10', '/', 'transaction')))
    assert r.status_code == 404
    assert r.headers['Content-Type'] == 'application/json'
    result = json.loads(r.text)
    assert 'message' in result
    assert result['message'] == "user 10 not found"


def test_empty_transactions():
    r = requests.get(''.join((URL + ('transaction',))))
    assert r.status_code == 200
    assert r.headers['Content-Type'] == 'application/json'
    transactions = json.loads(r.text)
    assert {'overall_count', 'limit', 'offset', 'entries'}.issubset(transactions)
    assert transactions['overall_count'] == 0
    assert transactions['limit'] == 100
    assert transactions['offset'] == 0
    assert transactions['entries'] == []


@@ -73,16 +73,64 @@
 , %22/%22)%0A%0A
+HEADERS = %7B'Content-Type': 'application/json'%7D%0A%0A
 %0Adef tes
@@ -193,17 +193,16 @@
 ('user',
- 
 )))%0A    
@@ -1596,28 +1596,1137 @@
 nsactions%5B'entries'%5D == %5B%5D%0A%0A
+%0Adef test_user_limits():%0A    r = requests.get(''.join(URL + ('user',)),%0A                     headers=HEADERS,%0A                     params=%7B'offset': 1, 'limit': 1%7D)%0A    assert r.status_code == 200%0A    assert r.headers%5B'Content-Type'%5D == 'application/json'%0A    transactions = json.loads(r.text)%0A    assert %7B'overall_count', 'limit', 'offset', 'entries'%7D.issubset(transactions)%0A    assert transactions%5B'overall_count'%5D == 0%0A    assert transactions%5B'limit'%5D == 1%0A    assert transactions%5B'offset'%5D == 1%0A    assert transactions%5B'entries'%5D == %5B%5D%0A%0A%0Adef test_user_limits_max():%0A    r = requests.get(''.join(URL + ('user',)),%0A                     headers=HEADERS,%0A                     params=%7B'offset': 0, 'limit': 1000%7D)%0A    assert r.status_code == 200%0A    assert r.headers%5B'Content-Type'%5D == 'application/json'%0A    transactions = json.loads(r.text)%0A    assert %7B'overall_count', 'limit', 'offset', 'entries'%7D.issubset(transactions)%0A    assert transactions%5B'overall_count'%5D == 0%0A    assert transactions%5B'limit'%5D == 250  # 250 is the max%0A    assert transactions%5B'offset'%5D == 0%0A    assert transactions%5B'entries'%5D == %5B%5D%0A%0A

Add tests for user limits