Permalink
Browse files

Add fts app

  • Loading branch information...
1 parent aab91ce commit 9fd0eb1c91e16e94e2b1a72357e40627cafb163f Delgermurun committed May 22, 2012
Showing with 64 additions and 0 deletions.
  1. 0 mysite/fts/__init__.py
  2. +20 −0 mysite/fts/fixtures/admin_user.json
  3. +3 −0 mysite/fts/models.py
  4. +40 −0 mysite/fts/tests.py
  5. +1 −0 mysite/fts/views.py
View
No changes.
@@ -0,0 +1,20 @@
+[
+ {
+ "pk": 1,
+ "model": "auth.user",
+ "fields": {
+ "username": "admin",
+ "first_name": "",
+ "last_name": "",
+ "is_active": true,
+ "is_superuser": true,
+ "is_staff": true,
+ "last_login": "2012-05-22T22:45:34.600Z",
+ "groups": [],
+ "user_permissions": [],
+ "password": "pbkdf2_sha256$10000$fdN0594jpHIl$NhN5UCMHs8sNp7UE2Zrifoi91GOwdpX5S5e9XnGmcOc=",
+ "email": "info@delgermurun.com",
+ "date_joined": "2012-05-22T22:45:01.667Z"
+ }
+ }
+]
View
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
View
@@ -0,0 +1,40 @@
+from django.test import LiveServerTestCase
+from selenium import webdriver
+from selenium.webdriver.common.keys import Keys
+
+class PollsTest(LiveServerTestCase):
+ fixtures = ['admin_user.json']
+
+ def setUp(self):
+ self.browser = webdriver.Firefox()
+
+ def tearDown(self):
+ self.browser.quit()
+
+ def test_can_create_new_poll_via_admin_site(self):
+ # Gertrude opens her web browser, and goer to the admin page
+ self.browser.get(self.live_server_url + '/admin/')
+
+ # She sees the familiar 'Django administration' heading
+ body = self.browser.find_element_by_tag_name('body')
+ self.assertIn('Django administration', body.text)
+
+ # She types in her username and passwords and hits return
+ username_field = self.browser.find_element_by_name('username')
+ username_field.send_keys('admin')
+
+ password_field = self.browser.find_element_by_name('password')
+ password_field.send_keys('1')
+ password_field.send_keys(Keys.RETURN)
+
+ # her username and password are accepted, and she is taken to
+ # the Site Administration page
+ body = self.browser.find_element_by_tag_name('body')
+ self.assertIn('Site administration', body.text)
+
+ # She now sees a couple of hyperlink that says "Polls"
+ polls_links = self.browser.find_elements_by_link_text('Polls')
+ self.assertEquals(len(polls_links), 2)
+
+ # TODO: Gerture uses the admin site to create a new Poll
+ self.fail('todo: finish tests')
View
@@ -0,0 +1 @@
+# Create your views here.

0 comments on commit 9fd0eb1

Please sign in to comment.