Initial commit
This commit is contained in:
0
web/palindromes/__init__.py
Normal file
0
web/palindromes/__init__.py
Normal file
3
web/palindromes/admin.py
Normal file
3
web/palindromes/admin.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
5
web/palindromes/apps.py
Normal file
5
web/palindromes/apps.py
Normal file
@ -0,0 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class PalindromesConfig(AppConfig):
|
||||
name = 'palindromes'
|
3
web/palindromes/models.py
Normal file
3
web/palindromes/models.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
19
web/palindromes/tests.py
Normal file
19
web/palindromes/tests.py
Normal file
@ -0,0 +1,19 @@
|
||||
from django.urls import resolve
|
||||
from django.test import TestCase
|
||||
from django.http import HttpRequest
|
||||
from palindromes.views import caculate_palindromes
|
||||
|
||||
|
||||
class HomePageTest(TestCase):
|
||||
|
||||
def test_root_url_resolves_to_calculate_palindrome_view(self):
|
||||
found = resolve('/')
|
||||
self.assertEqual(found.func, caculate_palindromes)
|
||||
|
||||
def test_home_page_returns_correct_html(self):
|
||||
request = HttpRequest()
|
||||
response = caculate_palindromes(request)
|
||||
html = response.content.decode('utf8')
|
||||
self.assertTrue(html.startswith('<html>'))
|
||||
self.assertIn('<title>Palindromes!</title>', html)
|
||||
self.assertTrue(html.endswith('</html>'))
|
5
web/palindromes/views.py
Normal file
5
web/palindromes/views.py
Normal file
@ -0,0 +1,5 @@
|
||||
from django.http import HttpResponse
|
||||
|
||||
|
||||
def caculate_palindromes(request):
|
||||
return HttpResponse('<html><title>Palindromes!</title></html>')
|
Reference in New Issue
Block a user