def test_auth(defconfig):
    random_msg = uuid.uuid4().hex
    request = Request('GET', '/authorize', {
        'echo': random_msg,
    })
    request.sign()
    resp = request.send()
    assert resp.status == 200
    data = resp.json()
    assert data['authorized'] == 'yes'
    assert data['echo'] == random_msg
def test_auth_missing_body(defconfig):
    request = Request('GET', '/authorize')
    request.sign()
    resp = request.send()
    assert resp.status == 400
def test_auth_malformed(defconfig):
    request = Request('GET', '/authorize')
    request.content = b'<this is not json>'
    request.sign()
    resp = request.send()
    assert resp.status == 400