Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 31 by michaelmwu: Unit tests fail
http://code.google.com/p/django-messages/issues/detail?id=31

What steps will reproduce the problem?
1. Run manage.py test

What is the expected output? What do you see instead?
I expect the tests not to fail!

I get:
======================================================================
FAIL: testBasic (messages.tests.DeleteTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "/usr/lib/python2.5/site-packages/messages/tests.py", line 35, in
testBasic
     self.assertEquals(self.user1.sent_messages.count(), 1)
AssertionError: 2 != 1

----------------------------------------------------------------------
Ran 35 tests in 9.357s

FAILED (failures=1)
Destroying test database...

What version of the product are you using? On what operating system?
I am using 0.40 on Cygwin on Vista, with PostgresSQL. I also got this on
Cygwin on XP, using SQLite

Please provide any additional information below.

I don't think this test case is correct! We aren't using a custom related
manager that would exclude deleted messages.

class DeleteTestCase(TestCase):
     def setUp(self):
         self.user1 = User.objects.create_user('user3', '[email protected]',
'123456')
         self.user2 = User.objects.create_user('user4', '[email protected]',
'123456')
         self.msg1 = Message(sender=self.user1, recipient=self.user2,
subject='Subject Text 1', body='Body Text 1')
         self.msg2 = Message(sender=self.user1, recipient=self.user2,
subject='Subject Text 2', body='Body Text 2')
         self.msg1.sender_deleted_at = datetime.datetime.now()
         self.msg2.recipient_deleted_at = datetime.datetime.now()
         self.msg1.save()
         self.msg2.save()

     def testBasic(self):
         self.assertEquals(self.user1.sent_messages.count(), 1)
         self.assertEquals(self.user1.sent_messages.all()[0].subject,
'Subject Text 2')
         self.assertEquals(self.user2.received_messages.count(),1)
         self.assertEquals(self.user2.received_messages.all()[0].subject,
'Subject Text 1')
         #undelete
         self.msg1.sender_deleted_at = None
         self.msg2.recipient_deleted_at = None
         self.msg1.save()
         self.msg2.save()
         self.assertEquals(self.user1.sent_messages.count(), 2)
         self.assertEquals(self.user2.received_messages.count(),2)


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

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

Reply via email to