Skip to content

Commit

Permalink
Upgrade celery, Fix integration tests
Browse files Browse the repository at this point in the history
Upgrade celery to latest.  The celery task application will need to be
reset.

Integration (lettuce) tests only run properly with Firefox 10.  A
setting has been added to specify the path to the firefox binary to use
for testing.
  • Loading branch information
yourcelf committed May 29, 2012
1 parent 5073236 commit c4fb1bb
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 29 deletions.
12 changes: 9 additions & 3 deletions scanblog/btb/features/common-steps.py
Expand Up @@ -7,13 +7,17 @@
from selenium import webdriver from selenium import webdriver


from django.contrib.auth.models import User, Group from django.contrib.auth.models import User, Group
from django.conf import settings
from profiles.models import Organization from profiles.models import Organization
from btblettuce import hard_click


@before.all @before.all
def get_browser(): def get_browser():
world.browser = webdriver.Firefox() binary = webdriver.firefox.firefox_binary.FirefoxBinary(

firefox_path=settings.SELENIUM_FIREFOX_BIN
world.browser.implicitly_wait(1) )
world.browser = webdriver.Firefox(firefox_binary=binary)
world.browser.implicitly_wait(2)


@before.all @before.all
def set_up_user(): def set_up_user():
Expand Down Expand Up @@ -125,6 +129,7 @@ def see_header(step, text):
@step(u'I am redirected to login') @step(u'I am redirected to login')
def i_am_redirected_to_login(step): def i_am_redirected_to_login(step):
# URL is correct.... # URL is correct....
time.sleep(1)
assert world.browser.current_url.split("?")[0] == django_url("/accounts/login/"), "Expected %s, got %s" % (django_url("/accounts/login/"), world.browser.current_url.split("?")[0]) assert world.browser.current_url.split("?")[0] == django_url("/accounts/login/"), "Expected %s, got %s" % (django_url("/accounts/login/"), world.browser.current_url.split("?")[0])
# ... and login form exists (e.g. page rendered properly) # ... and login form exists (e.g. page rendered properly)
world.browser.find_element_by_class_name('login-form') world.browser.find_element_by_class_name('login-form')
Expand Down Expand Up @@ -158,6 +163,7 @@ def i_login_as(step, username, password):
def i_click_the_button(step, value): def i_click_the_button(step, value):
el = world.browser.find_element_by_xpath('//input[@value="%s"]' % value) el = world.browser.find_element_by_xpath('//input[@value="%s"]' % value)
el.click() el.click()
time.sleep(1)


@step(u'I click the submit button') @step(u'I click the submit button')
def i_click_the_submit_button(step): def i_click_the_submit_button(step):
Expand Down
3 changes: 2 additions & 1 deletion scanblog/btb/features/mod-users-steps.py
Expand Up @@ -7,8 +7,8 @@


@step('I type "([^"]*)" in the user search form') @step('I type "([^"]*)" in the user search form')
def i_type_text_in_the_user_search_form(step, text): def i_type_text_in_the_user_search_form(step, text):
el = css(".user-chooser-trigger")
time.sleep(0.5) time.sleep(0.5)
el = css(".user-chooser-trigger")
el.send_keys(text[0]) el.send_keys(text[0])
time.sleep(0.5) time.sleep(0.5)
el = css(".user-search") el = css(".user-search")
Expand All @@ -26,6 +26,7 @@ def i_click_the_first_user_choice(step):


@step('I search for the user "([^"]*)"') @step('I search for the user "([^"]*)"')
def i_search_for_the_user(step, text): def i_search_for_the_user(step, text):
world.browser.get(django_url("/moderation/"))
world.browser.get(django_url("/moderation/#/users")) world.browser.get(django_url("/moderation/#/users"))
i_type_text_in_the_user_search_form(step, text) i_type_text_in_the_user_search_form(step, text)


Expand Down
2 changes: 1 addition & 1 deletion scanblog/correspondence/tasks.py
@@ -1,4 +1,4 @@
from celery.decorators import task from celery.task import task


from correspondence.models import Mailing, Letter from correspondence.models import Mailing, Letter


Expand Down
1 change: 1 addition & 0 deletions scanblog/default_settings.py
Expand Up @@ -213,3 +213,4 @@


MAX_READY_TO_PUBLISH_DAYS = 3 MAX_READY_TO_PUBLISH_DAYS = 3
PUBLISHING_HOURS = (7, 23) PUBLISHING_HOURS = (7, 23)
SELENIUM_FIREFOX_BIN = "/usr/bin/firefox"
1 change: 1 addition & 0 deletions scanblog/example.settings.py
Expand Up @@ -126,3 +126,4 @@
} }
} }


SELENIUM_FIREFOX_BIN = "/home/tc1/src/firefox/firefox"
1 change: 0 additions & 1 deletion scanblog/fromage.py
Expand Up @@ -32,7 +32,6 @@
preexec_fn=os.setsid) preexec_fn=os.setsid)


return_code = 0 return_code = 0

if runtests: if runtests:
try: try:
collectstatic = subprocess.Popen( collectstatic = subprocess.Popen(
Expand Down
9 changes: 4 additions & 5 deletions scanblog/requirements.txt
@@ -1,12 +1,10 @@
django>=1.3.1 django==1.4
psycopg2==2.4.1 psycopg2==2.4.1
-e hg+http://bitbucket.org/ubernostrum/django-registration#egg=django-registration -e hg+http://bitbucket.org/ubernostrum/django-registration#egg=django-registration
# Require celery 2.2 because of backwards incompatibility introduced in 2.3 -- # Require celery 2.2 because of backwards incompatibility introduced in 2.3 --
# upgrade when resolved. # upgrade when resolved.
Celery<2.3 Celery
django-celery<2.3 django-celery
# Require python-dateutil 1.5 due to this issue: https://groups.google.com/group/celery-users/browse_thread/thread/08f754dbba35d1f4/b2587c10d65c64e3?lnk=raot
python-dateutil==1.5
pyPdf pyPdf
PIL PIL
amqplib amqplib
Expand All @@ -24,3 +22,4 @@ South
pyyaml pyyaml
django-debug-toolbar django-debug-toolbar
reportlab reportlab
selenium<=2.20 # Due to this bug: https://code.google.com/p/selenium/issues/detail?id=3736
2 changes: 1 addition & 1 deletion scanblog/scanning/tasks.py
Expand Up @@ -17,7 +17,7 @@


from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.conf import settings from django.conf import settings
from celery.decorators import task from celery.task import task
from sorl.thumbnail import get_thumbnail from sorl.thumbnail import get_thumbnail


from scanning.models import Scan, ScanPage, Document, DocumentPage, EditLock from scanning.models import Scan, ScanPage, Document, DocumentPage, EditLock
Expand Down
10 changes: 7 additions & 3 deletions scanblog/static/js/moderation/documents.coffee
Expand Up @@ -15,6 +15,7 @@ class btb.DocumentList extends btb.FilteredPaginatedCollection


class btb.EditDocumentManager extends Backbone.View class btb.EditDocumentManager extends Backbone.View
template: _.template $("#editDocumentsManager").html() template: _.template $("#editDocumentsManager").html()

initialize: (options=documents: []) -> initialize: (options=documents: []) ->
@documents = new btb.DocumentList @documents = new btb.DocumentList
@documents.filter.idlist = options.documents.join(".") @documents.filter.idlist = options.documents.join(".")
Expand Down Expand Up @@ -329,15 +330,14 @@ class btb.EditDocumentPageView extends Backbone.View
'click .move-page-up': 'movePageUp' 'click .move-page-up': 'movePageUp'
'click .move-page-down': 'movePageDown' 'click .move-page-down': 'movePageDown'
'click .crop': 'crop' 'click .crop': 'crop'
'click .highlight': 'highlight' 'click .highlight': 'highlightMe'
'mousemove .page-image': 'mouseMove' 'mousemove .page-image': 'mouseMove'
'mousedown .page-image': 'mouseDown' 'mousedown .page-image': 'mouseDown'


grabMargin: 4 grabMargin: 4
scale: 1 scale: 1


initialize: (options=page: null, pagecount: 1) -> initialize: (options=page: null, pagecount: 1) ->
@highlight = null
@page = options.page @page = options.page
@page.transformations = @page.transformations or {} @page.transformations = @page.transformations or {}
@pagecount = options.pagecount @pagecount = options.pagecount
Expand All @@ -351,6 +351,9 @@ class btb.EditDocumentPageView extends Backbone.View
if @mouseIsDown if @mouseIsDown
@mouseUp(event) @mouseUp(event)


highlightMe: =>
@setHighlighting(not @highlighting)

render: => render: =>
$(@el).html @template(page: @page, pagecount: @pagecount) $(@el).html @template(page: @page, pagecount: @pagecount)
@canvas = $(".page-image", @el)[0] @canvas = $(".page-image", @el)[0]
Expand Down Expand Up @@ -460,6 +463,7 @@ class btb.EditDocumentPageView extends Backbone.View
@trigger "movePageDown" @trigger "movePageDown"


crop: => @setCropping(not @cropping) crop: => @setCropping(not @cropping)

setCropping: (cropping, trigger=true) => setCropping: (cropping, trigger=true) =>
@cropping = cropping @cropping = cropping
if @cropping if @cropping
Expand All @@ -468,7 +472,7 @@ class btb.EditDocumentPageView extends Backbone.View
if trigger if trigger
@trigger "cropping", @cropping @trigger "cropping", @cropping


highlight: => @setHighlighting(not @highlighting)
setHighlighting: (highlighting, trigger=true) => setHighlighting: (highlighting, trigger=true) =>
@highlighting = highlighting @highlighting = highlighting
if @highlighting if @highlighting
Expand Down
15 changes: 7 additions & 8 deletions scanblog/static/js/moderation/documents.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions scanblog/static/js/moderation/scans.coffee
Expand Up @@ -3,8 +3,6 @@
# #
class btb.Scan extends Backbone.Model class btb.Scan extends Backbone.Model
url: -> btb.ScanList.prototype.baseUrl + "/" + @id url: -> btb.ScanList.prototype.baseUrl + "/" + @id
parse: (response) ->
response.results[0]


class btb.ScanList extends btb.FilteredPaginatedCollection class btb.ScanList extends btb.FilteredPaginatedCollection
model: btb.Scan model: btb.Scan
Expand Down
4 changes: 0 additions & 4 deletions scanblog/static/js/moderation/scans.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c4fb1bb

Please sign in to comment.