Author: kkubasik
Date: 2009-06-23 14:16:31 -0500 (Tue, 23 Jun 2009)
New Revision: 11092

Added:
   django/branches/soc2009/test-improvements/tests/templates/flatpages/
   
django/branches/soc2009/test-improvements/tests/templates/flatpages/default.html
Modified:
   django/branches/soc2009/test-improvements/
   
django/branches/soc2009/test-improvements/django/core/management/commands/test.py
   
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/urls.py
   
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/windmilltests/__init__.py
   django/branches/soc2009/test-improvements/tests/runtests.py
Log:
 r10...@kevin-kubasiks-macbook:  kkubasik | 2009-06-23 13:14:52 -0600
 [gsoc2009-testing] Introduced windmill tests for several contrib components in 
the admin. Made new runner framework backwords compatible with old style test 
runners. Added the option to run just the windmill tests in the regressionsuite.



Property changes on: django/branches/soc2009/test-improvements
___________________________________________________________________
Name: svk:merge
   - 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10902
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10894
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054
   + 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10904
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10894
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054

Modified: 
django/branches/soc2009/test-improvements/django/core/management/commands/test.py
===================================================================
--- 
django/branches/soc2009/test-improvements/django/core/management/commands/test.py
   2009-06-23 12:55:05 UTC (rev 11091)
+++ 
django/branches/soc2009/test-improvements/django/core/management/commands/test.py
   2009-06-23 19:16:31 UTC (rev 11092)
@@ -25,7 +25,10 @@
         cover = options.get('coverage', False)
         report = options.get('reports', False)
         test_runner = get_runner(settings, coverage=cover, reports=report)
-        tr = test_runner()
-        failures = tr.run_tests(test_labels, verbosity=verbosity, 
interactive=interactive)
+        if(type(test_runner) == 'function'):
+            failures = test_runner(test_labels, verbosity=verbosity, 
interactive=interactive)
+        else:
+            tr = test_runner()
+            failures = tr.run_tests(test_labels, verbosity=verbosity, 
interactive=interactive)
         if failures:
             sys.exit(failures)

Modified: 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/urls.py
===================================================================
--- 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/urls.py
 2009-06-23 12:55:05 UTC (rev 11091)
+++ 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/urls.py
 2009-06-23 19:16:31 UTC (rev 11092)
@@ -3,6 +3,10 @@
 import views
 import customadmin
 
+from django.contrib import admin
+admin.autodiscover()
+
+
 urlpatterns = patterns('',
     (r'^admin/doc/', include('django.contrib.admindocs.urls')),
     (r'^admin/secure-view/$', views.secure_view),

Modified: 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/windmilltests/__init__.py
===================================================================
--- 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/windmilltests/__init__.py
       2009-06-23 12:55:05 UTC (rev 11091)
+++ 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/windmilltests/__init__.py
       2009-06-23 19:16:31 UTC (rev 11092)
@@ -343,4 +343,162 @@
     client.waits.forPageLoad(timeout=u'20000')
     client.waits.forElement(link=u'        Home       ', timeout=u'8000')
     client.click(link=u'        Home       ')
-    client.waits.forPageLoad(timeout=u'20000')
\ No newline at end of file
+    client.waits.forPageLoad(timeout=u'20000')
+
+def test_recordingSuite8():
+    client = WindmillTestClient(__name__)
+
+    client.open(url="http://localhost:8000/test_admin/admin";)
+    client.waits.forPageLoad(timeout=u'20000')
+    
client.waits.forElement(xpath=u"//d...@id='content-main']/div/table/tbody/tr[21]/td/a",
 timeout=u'8000')
+    
client.click(xpath=u"//d...@id='content-main']/div/table/tbody/tr[21]/td/a")
+    client.click(name=u'_save')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'Recommender object')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'Home')
+    client.waits.forPageLoad(timeout=u'20000')
+    
client.click(xpath=u"//d...@id='content-main']/div/table/tbody/tr[20]/td/a")
+    client.click(id=u'id_recommender')
+    client.select(option=u'Recommender object', id=u'id_recommender')
+    client.click(value=u'1')
+    client.click(name=u'_save')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'Languages')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'              Add language             ')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.type(text=u'en', id=u'id_iso')
+    client.type(text=u'testEnglish', id=u'id_name')
+    client.type(text=u'test', id=u'id_english_name')
+    
client.click(xpath=u"//fo...@id='language_form']/div/fieldset/div[4]/div/label")
+    client.check(id=u'id_shortlist')
+    client.click(name=u'_save')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'        Home       ')
+    client.waits.forPageLoad(timeout=u'20000')
+
+def test_AdminAuthContrib():
+    client = WindmillTestClient(__name__)
+
+    client.open(url="http://localhost:8000/test_admin/admin";)
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(link=u'Users', timeout=u'8000')
+    client.click(link=u'Users')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.asserts.assertNode(link=u'adduser')
+    client.asserts.assertNode(link=u'admin')
+    client.asserts.assertNode(link=u'changeuser')
+    client.asserts.assertNode(link=u'deleteuser')
+    client.asserts.assertNode(link=u'joepublic')
+    client.asserts.assertNode(link=u'super')
+    client.click(link=u'Yes')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.asserts.assertNode(link=u'adduser')
+    client.asserts.assertNode(link=u'admin')
+    client.asserts.assertNode(link=u'changeuser')
+    client.asserts.assertNode(link=u'deleteuser')
+    client.asserts.assertNode(link=u'super')
+    client.click(link=u'6 total')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(link=u'super', timeout=u'8000')
+    client.click(link=u'super')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(link=u'Clear all', timeout=u'8000')
+    client.click(link=u'Clear all')
+    client.click(link=u'Choose all')
+    client.click(name=u'_continue')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.asserts.assertValue(validator=u'2007-05-30', id=u'id_date_joined_0')
+    client.asserts.assertValue(validator=u'13:20:10', id=u'id_date_joined_1')
+    client.asserts.assertValue(validator=u'Super', id=u'id_first_name')
+    client.asserts.assertValue(validator=u'User', id=u'id_last_name')
+    client.asserts.assertValue(validator=u'su...@example.com', id=u'id_email')
+    client.asserts.assertValue(validator=u'on', id=u'id_is_staff')
+    client.asserts.assertValue(validator=u'on', id=u'id_is_active')
+    client.asserts.assertValue(validator=u'on', id=u'id_is_superuser')
+    client.asserts.assertValue(validator=u'super', id=u'id_username')
+    client.click(link=u'Users')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.type(text=u'super', id=u'searchbar')
+    client.click(value=u'Search')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.asserts.assertNode(link=u'super')
+    client.click(link=u'6 total')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.waits.forElement(link=u'        Home       ', timeout=u'8000')
+    client.click(link=u'        Home       ')
+    client.waits.forPageLoad(timeout=u'20000')
+
+
+def test_contribFlatSitesRedirect():
+    client = WindmillTestClient(__name__)
+
+    client.open(url="http://localhost:8000/test_admin/admin";)
+    client.waits.forPageLoad(timeout=u'20000')
+    
client.click(xpath=u"//d...@id='content-main']/div[4]/table/tbody/tr[1]/td/a")
+    client.click(id=u'id_url')
+    client.type(text=u'/testflat/test/', id=u'id_url')
+    client.type(text=u'Test Flat', id=u'id_title')
+    client.type(text=u'This is some unique test content.', id=u'id_content')
+    client.click(value=u'1')
+    client.click(id=u'fieldsetcollapser1')
+    client.check(id=u'id_enable_comments')
+    client.click(name=u'_save')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'/testflat/test/')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'Home')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'Flat pages')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'        Home       ')
+    client.waits.forPageLoad(timeout=u'20000')
+    
client.click(xpath=u"//d...@id='content-main']/div[6]/table/tbody/tr[1]/th/a")
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'example.com')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(id=u'id_domain')
+    client.doubleClick(id=u'id_domain')
+    client.type(text=u'localhost', id=u'id_domain')
+    client.click(name=u'_save')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'        Home       ')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'Flat pages')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'/testflat/test/')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'View on site')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.asserts.assertText(xpath=u'/html/body', validator=u'This is some 
unique test content. ')
+    client.goBack()
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'Home')
+    client.waits.forPageLoad(timeout=u'20000')
+    
client.click(xpath=u"//d...@id='content-main']/div[5]/table/tbody/tr[1]/th/a")
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'              Add redirect             ')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(xpath=u"//u...@id='id_site']/li/label")
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(id=u'id_site_0')
+    client.radio(id=u'id_site_0')
+    client.click(id=u'id_old_path')
+    client.type(text=u'/events/test', id=u'id_old_path')
+    client.type(text=u'/', id=u'id_new_path')
+    client.type(text=u'/test_admin/', id=u'id_new_path')
+    client.click(id=u'id_new_path')
+    client.doubleClick(id=u'id_new_path')
+    client.type(text=u'/testflat/test/', id=u'id_new_path')
+    client.click(name=u'_save')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'/events/test')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.click(link=u'Home')
+    client.waits.forPageLoad(timeout=u'20000')
+    client.open(url=u'http://localhost:8000/events/test')
+    client.waits.forPageLoad(timeout=u'8000')
+    client.asserts.assertText(xpath=u'/html/body', validator=u'This is some 
unique test content. ')
+    client.open(url=u'http://localhost:8000/test_admin/admin/')
+    client.waits.forPageLoad(timeout=u'8000')
\ No newline at end of file

Modified: django/branches/soc2009/test-improvements/tests/runtests.py
===================================================================
--- django/branches/soc2009/test-improvements/tests/runtests.py 2009-06-23 
12:55:05 UTC (rev 11091)
+++ django/branches/soc2009/test-improvements/tests/runtests.py 2009-06-23 
19:16:31 UTC (rev 11092)
@@ -170,9 +170,16 @@
     #'from .* import .*', 'import .*', ]
     settings.COVERAGE_ADDITIONAL_MODULES = ['django']
     # 'from .* import .*', 'import .*',
-    test_runner = get_runner(settings, coverage=True, reports=True)
-    tr = test_runner()
-    failures = tr.run_tests(test_labels, verbosity=verbosity, 
interactive=interactive, extra_tests=extra_tests)
+    if(do_std):
+        if(do_coverage):
+            test_runner = get_runner(settings, coverage=True, reports=True)
+        else:
+            test_runner = get_runner(settings, coverage=False, reports=False)
+        if(type(test_runner) == 'function'):
+            failures = test_runner(test_labels, verbosity=verbosity, 
interactive=interactive, extra_tests=extra_tests)
+        else:
+            tr = test_runner()
+            failures = tr.run_tests(test_labels, verbosity=verbosity, 
interactive=interactive, extra_tests=extra_tests)
     #from windmill.authoring import djangotest
     from time import sleep
 
@@ -191,11 +198,17 @@
         #      print cache.app_store
         # m = cache.app_models['invalid_models']
         #        print m
-        mod = import_module('.models','modeltests.invalid_models')
-        del cache.app_store[mod]
-        del cache.app_models['invalid_models']
+        if(do_std):
+            mod = import_module('.models','modeltests.invalid_models')
+            try:
+                del cache.app_store[mod]
+                del cache.app_models['invalid_models']
+            except Exception, e:
+                print e
+                pass
 
 
+
         # print cache.app_models
         #        print cache.app_store
         #from django.test import windmill_tests
@@ -291,7 +304,9 @@
     settings.LOGIN_URL = old_login_url
     settings.MIDDLEWARE_CLASSES = old_middleware_classes
 
-global do_windmill
+# global do_windmill
+# global do_coverage
+# global do_std
 if __name__ == "__main__":
     from optparse import OptionParser
     usage = "%prog [options] [model model model ...]"
@@ -303,6 +318,10 @@
         help='Tells Django to NOT prompt the user for input of any kind.')
     parser.add_option('--windmill', action='store_true', dest='windmill', 
default=False,
             help='Tells Django to run the Windmill functional tests as well.')
+    parser.add_option('--coverage', action='store_true', dest='coverage', 
default=False,
+            help='Tells Django to run the tests with code coverage as well.')
+    parser.add_option('--nostd', action='store_false', dest='standard', 
default=True,
+            help='Tells Django to not run the standard regression suite.')
     parser.add_option('--settings',
         help='Python path to settings module, e.g. "myproject.settings". If 
this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be 
used.')
     options, args = parser.parse_args()
@@ -312,4 +331,6 @@
         parser.error("DJANGO_SETTINGS_MODULE is not set in the environment. "
                       "Set it or use --settings.")
     do_windmill = options.windmill
+    do_coverage = options.coverage
+    do_std = options.standard
     django_tests(int(options.verbosity), options.interactive, args)

Added: 
django/branches/soc2009/test-improvements/tests/templates/flatpages/default.html
===================================================================
--- 
django/branches/soc2009/test-improvements/tests/templates/flatpages/default.html
                            (rev 0)
+++ 
django/branches/soc2009/test-improvements/tests/templates/flatpages/default.html
    2009-06-23 19:16:31 UTC (rev 11092)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+    "http://www.w3.org/TR/REC-html40/loose.dtd";>
+<html>
+<head>
+<title>{{ flatpage.title }}</title>
+</head>
+<body>
+{{ flatpage.content }}
+</body>
+</html>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to