Просмотр исходного кода

Finally... make a movie library app :D

Benoît Hubert 7 лет назад
Родитель
Сommit
8361611351

+ 21 - 3
functional_tests.py

@@ -1,6 +1,24 @@
 from selenium import webdriver
+import unittest
 
-browser = webdriver.Firefox()
-browser.get('http://localhost:8000')
+class NewVisitorTest(unittest.TestCase):
 
-assert 'Django' in browser.title
+    def setUp(self):
+        self.browser = webdriver.Firefox()
+
+    def tearDown(self):
+        self.browser.quit()
+
+    def test_can_start_a_list_and_retrieve_it_later(self):
+        # Edith has heard about a cool new online to-do app. She goes
+        # to check out its homepage
+        self.browser.get('http://localhost:8000')
+
+        # She notices the page title and header mention to-do lists
+        self.assertIn('MovieLib', self.browser.title)
+        self.fail('Finish the test!')
+
+        # She is invited to enter a to-do item straight away
+
+if __name__ == '__main__':
+    unittest.main(warnings='ignore')

+ 1 - 1
manage.py

@@ -3,7 +3,7 @@ import os
 import sys
 
 if __name__ == "__main__":
-    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "notepad.settings")
+    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "movielib.settings")
     try:
         from django.core.management import execute_from_command_line
     except ImportError as exc:

notepad/__init__.py → movielib/__init__.py


+ 4 - 4
notepad/settings.py

@@ -1,5 +1,5 @@
 """
-Django settings for notepad project.
+Django settings for movielib project.
 
 Generated by 'django-admin startproject' using Django 2.0.2.
 
@@ -20,7 +20,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
 
 # SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = '543-$@vk0oezb+q(kmo)!i9um%h6xw7(wua5!1b)osbk0id%bt'
+SECRET_KEY = '!ac2y*6f$oo!$nv9jor@p49q@#j)qem^=!a86xc0+z&phu76b6'
 
 # SECURITY WARNING: don't run with debug turned on in production!
 DEBUG = True
@@ -49,7 +49,7 @@ MIDDLEWARE = [
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
 ]
 
-ROOT_URLCONF = 'notepad.urls'
+ROOT_URLCONF = 'movielib.urls'
 
 TEMPLATES = [
     {
@@ -67,7 +67,7 @@ TEMPLATES = [
     },
 ]
 
-WSGI_APPLICATION = 'notepad.wsgi.application'
+WSGI_APPLICATION = 'movielib.wsgi.application'
 
 
 # Database

+ 1 - 1
notepad/urls.py

@@ -1,4 +1,4 @@
-"""notepad URL Configuration
+"""movielib URL Configuration
 
 The `urlpatterns` list routes URLs to views. For more information please see:
     https://docs.djangoproject.com/en/2.0/topics/http/urls/

+ 2 - 2
notepad/wsgi.py

@@ -1,5 +1,5 @@
 """
-WSGI config for notepad project.
+WSGI config for movielib project.
 
 It exposes the WSGI callable as a module-level variable named ``application``.
 
@@ -11,6 +11,6 @@ import os
 
 from django.core.wsgi import get_wsgi_application
 
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "notepad.settings")
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "movielib.settings")
 
 application = get_wsgi_application()

+ 0 - 0
movies/__init__.py


+ 3 - 0
movies/admin.py

@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.

+ 5 - 0
movies/apps.py

@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class MoviesConfig(AppConfig):
+    name = 'movies'

+ 0 - 0
movies/migrations/__init__.py


+ 3 - 0
movies/models.py

@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.

+ 6 - 0
movies/tests.py

@@ -0,0 +1,6 @@
+from django.test import TestCase
+
+class SmokeTest(TestCase):
+
+    def test_bad_maths(self):
+        self.assertEqual(1 + 1, 3)

+ 3 - 0
movies/views.py

@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.