Example #1
0
	def test_no_match(self):
		view = ViewEmployees.as_view()
                request = factory.get('/birthdays/?name=jacobjingleheimer')
                response = view(request)
                response.render()
                print response
                self.assertEqual(response.content, '[]')
Example #2
0
	def test_record_add(self):
		view = ViewEmployees.as_view()
		request = factory.get('/birthdays/')
		response = view(request)
		response.render()
		print response
		self.assertEqual(response.content, '[{"name":"Sally","birthday":"2014-01-01","favorite_ice_cream":"potato"}]')
Example #3
0
	def test_multiple_filters(self):
		view = ViewEmployees.as_view()
                request = factory.get('/birthdays/?name=sally&month=jan')
                response = view(request)
                response.render()
                print response
                self.assertEqual(response.content, '[{"name":"Sally","birthday":"2014-01-01","favorite_ice_cream":"potato"}]')
Example #4
0
"""birthdays URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Import the include() function: from django.conf.urls import url, include
    3. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import url, include
from django.contrib import admin
from teambirthdays import views as birthdays
from teambirthdays.views import ViewEmployees

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^birthdays/$', ViewEmployees.as_view()),
]