Skip to content

Commit

Permalink
✨ add health endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
lifenautjoe committed Nov 1, 2018
1 parent e2514ce commit c95de5a
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
/db.sqlite3
.env
*.pyc
debug.log
debug.log
reports
.coverage
7 changes: 4 additions & 3 deletions openbook_org/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@
INSTALLED_APPS = [
'django.contrib.contenttypes',
'rest_framework',
'openbook_org_contact',
'django_nose',
'mailchimp3'
'mailchimp3',
'openbook_org_contact',
'openbook_org_common',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -114,7 +115,7 @@
}
}

# Mail config
# Mail config

MAILGUN_API_KEY = os.environ.get('MAILGUN_API_KEY')
MAILCHIMP_API_KEY = os.environ.get('MAILCHIMP_API_KEY')
Expand Down
3 changes: 3 additions & 0 deletions openbook_org/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
"""
from django.contrib import admin
from django.urls import path, include

from openbook_org_common.views import Health
from openbook_org_contact.views import Contact, WaitlistSubscribeView

urlpatterns = [
path('health/', Health.as_view(), name='health'),
path('contact/', Contact.as_view(), name='contact'),
path('waitlist/subscribe/', WaitlistSubscribeView.as_view(), name='waitlist_subscribe')
]
Empty file added openbook_org_common/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions openbook_org_common/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions openbook_org_common/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class OpenbookOrgCommonConfig(AppConfig):
name = 'openbook_org_common'
Empty file.
3 changes: 3 additions & 0 deletions openbook_org_common/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
18 changes: 18 additions & 0 deletions openbook_org_common/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from django.test import TestCase

# Create your tests here.
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase


class TestHealth(APITestCase):
"""
Health API
"""

url = reverse('health')

def test_should_say_hello(self):
response = self.client.get(self.url)
self.assertTrue(response.status_code, status.HTTP_200_OK)
12 changes: 12 additions & 0 deletions openbook_org_common/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django.shortcuts import render

# Create your views here.
from rest_framework.response import Response
from rest_framework.views import APIView


class Health(APIView):
def get(self, request):
return Response({
'message': 'All looking fly.'
})

0 comments on commit c95de5a

Please sign in to comment.