Example #1
0
def test_missing_email():
    with test_client(config=test_app.TEST_CONFIG) as client:
        login_response = client.post(
            "/api/v1/auth/login",
            data=dumps({"password": "******"}),
            content_type="application/json",
        )
        assert login_response.status_code == 400

        user_response = client.get("/api/v1/auth/user")
        assert user_response.status_code == 401
Example #2
0
def test_login_no_config():
    with test_client() as client:
        login_response = client.post(
            "/api/v1/auth/login",
            data=dumps({
                "email": "*****@*****.**",
                "password": "******"
            }),
            content_type="application/json",
        )
        assert login_response.status_code == 400
Example #3
0
def test_wrong_password():
    with test_client(config=test_app.TEST_CONFIG) as client:
        login_response = client.post(
            "/api/v1/auth/login",
            data=dumps({
                "email": "*****@*****.**",
                "password": "******"
            }),
            content_type="application/json",
        )
        assert login_response.status_code == 400

        user_response = client.get("/api/v1/auth/user")
        assert user_response.status_code == 401
Example #4
0
def test_healthy():
    healthy = test_client().get("/api/v1/health")
    # NB: Here we explicitly compare against True because we want this to be a boolean.
    assert healthy.json["healthy"] is True
Example #5
0
def test_login_invalid():
    assert test_client().post("/api/v1/auth/login").status_code == 400