Skip to content
This repository has been archived by the owner on Jul 21, 2019. It is now read-only.

Commit

Permalink
Use standard library HTTPStatus enum
Browse files Browse the repository at this point in the history
  • Loading branch information
textbook committed Mar 13, 2016
1 parent d260eef commit b154fcd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
9 changes: 0 additions & 9 deletions flask_forecaster/constants.py

This file was deleted.

5 changes: 3 additions & 2 deletions flask_forecaster/tracker/api.py
@@ -1,9 +1,10 @@
"""API interface."""

from http import HTTPStatus
import logging

import requests

from flask_forecaster.constants import HttpStatus
from flask_forecaster.tracker.models import ProjectSnapshot

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -64,7 +65,7 @@ def get_project_history(self, project_id, convert=False):
@staticmethod
def _handle_response(response):
"""Handle the standard response pattern."""
if response.status_code == HttpStatus.OK:
if response.status_code == HTTPStatus.OK:
result = response.json()
if 'error' in result:
logger.warning('API call failed with error %s', result['error'])
Expand Down
10 changes: 5 additions & 5 deletions tests/test_routes.py
@@ -1,20 +1,20 @@
from flask import url_for
from http import HTTPStatus

from flask_forecaster.constants import HttpStatus
from flask import url_for


def test_route_home(client):
response = client.get(url_for('home'))
assert response.status_code == HttpStatus.OK
assert response.status_code == HTTPStatus.OK


def test_route_project(client):
with client.session_transaction() as session:
session['token'] = 'foo'
response = client.get(url_for('project', project_id=123))
assert response.status_code == HttpStatus.OK
assert response.status_code == HTTPStatus.OK


def test_route_project_redirect(client):
response = client.get(url_for('project', project_id=123))
assert response.status_code == HttpStatus.REDIRECTED
assert response.status_code == HTTPStatus.FOUND

0 comments on commit b154fcd

Please sign in to comment.