Commits

Joe Stump committed 9c00773

Switched tests around so it'll test for messages in the mail.outbox before checking subjects.

Comments (0)

Files changed (1)

         """ Ensure creating a pending Consumer sends proper emails """
         # If it's pending we should have two messages in the outbox; one 
         # to the consumer and one to the site admins.
-        expected = "Your API Consumer for example.com is awaiting approval."
-        self.assertEquals(mail.outbox[0].subject, expected)
-
         if len(settings.ADMINS):
             self.assertEquals(len(mail.outbox), 2)
         else:
             self.assertEquals(len(mail.outbox), 1)
 
+        expected = "Your API Consumer for example.com is awaiting approval."
+        self.assertEquals(mail.outbox[0].subject, expected)
+
     def test_delete_consumer(self):
         """ Ensure deleting a Consumer sends a cancel email """
 
         # Delete the consumer, which should fire off the cancel email.
         self.consumer.delete() 
         
+        self.assertEquals(len(mail.outbox), 1)
         expected = "Your API Consumer for example.com has been canceled."
         self.assertEquals(mail.outbox[0].subject, expected)
-        self.assertEquals(len(mail.outbox), 1)