Fix a bunch of test errors, apparently the Textarea widget in Django

now outputs a newline in the beginning - this doesn't seem make a
difference for browsers, but it means testing with PyQuery needs to
strip the text to be able to check accurately
 - Legacy-Id: 6931
This commit is contained in:
Ole Laursen 2013-12-16 11:47:32 +00:00
parent 2eb8566d2f
commit 8017c8eaf2
3 changed files with 8 additions and 8 deletions

View file

@ -261,7 +261,7 @@ class ConflictReviewSubmitTests(TestCase):
r = self.client.get(url)
self.assertEquals(r.status_code,200)
q = PyQuery(r.content)
self.assertTrue(q('textarea')[0].text.startswith("[Edit this page"))
self.assertTrue(q('textarea[name="content"]')[0].text.strip().startswith("[Edit this page"))
# Faulty posts using textbox
# Right now, nothing to test - we let people put whatever the web browser will let them put into that textbox
@ -296,7 +296,7 @@ class ConflictReviewSubmitTests(TestCase):
r = self.client.get(url)
self.assertEquals(r.status_code,200)
q = PyQuery(r.content)
self.assertTrue(q('textarea')[0].text.startswith("This is the old proposal."))
self.assertTrue(q('textarea')[0].text.strip().startswith("This is the old proposal."))
# faulty posts trying to use file upload
# Copied from wgtracker tests - is this really testing the server code, or is it testing
@ -324,7 +324,7 @@ class ConflictReviewSubmitTests(TestCase):
r = self.client.post(url,dict(reset_text="1"))
self.assertEquals(r.status_code, 200)
q = PyQuery(r.content)
self.assertTrue(q('textarea')[0].text.startswith("[Edit this page"))
self.assertTrue(q('textarea')[0].text.strip().startswith("[Edit this page"))
def setUp(self):
make_test_data()

View file

@ -866,7 +866,7 @@ class IndividualInfoFormsTests(TestCase):
r = self.client.post(url,dict(txt=test_file,reset_text="1"))
self.assertEquals(r.status_code, 200)
q = PyQuery(r.content)
self.assertTrue(q('textarea')[0].text.startswith("As required by RFC 4858"))
self.assertTrue(q('textarea')[0].text.strip().startswith("As required by RFC 4858"))
def setUp(self):
make_test_data()
@ -943,7 +943,7 @@ class RequestPublicationTests(TestCase):
draft.set_state(State.objects.get(used=True, type="draft-stream-iab", slug="approved"))
url = urlreverse('doc_request_publication', kwargs=dict(name=draft.name))
login_testing_unauthorized(self, "iabchair", url)
login_testing_unauthorized(self, "iab-chair", url)
# normal get
r = self.client.get(url)

View file

@ -360,7 +360,7 @@ class StatusChangeSubmitTests(TestCase):
r = self.client.get(url)
self.assertEquals(r.status_code,200)
q = PyQuery(r.content)
self.assertTrue(q('textarea')[0].text.startswith("Provide a description"))
self.assertTrue(q('textarea')[0].text.strip().startswith("Provide a description"))
# Faulty posts using textbox
# Right now, nothing to test - we let people put whatever the web browser will let them put into that textbox
@ -395,7 +395,7 @@ class StatusChangeSubmitTests(TestCase):
r = self.client.get(url)
self.assertEquals(r.status_code,200)
q = PyQuery(r.content)
self.assertTrue(q('textarea')[0].text.startswith("This is the old proposal."))
self.assertTrue(q('textarea')[0].text.strip().startswith("This is the old proposal."))
# faulty posts trying to use file upload
# Copied from wgtracker tests - is this really testing the server code, or is it testing
@ -423,7 +423,7 @@ class StatusChangeSubmitTests(TestCase):
r = self.client.post(url,dict(reset_text="1"))
self.assertEquals(r.status_code, 200)
q = PyQuery(r.content)
self.assertTrue(q('textarea')[0].text.startswith("Provide a description"))
self.assertTrue(q('textarea')[0].text.strip().startswith("Provide a description"))
def setUp(self):
make_test_data()