Example #1
0
    def test_add_delete(self):
        attr = SubscriptionAttribute(self.env)
        attr.add(self.env, 'user', 1, 'GeneralWikiSubscriber','wiki',
                 ('TracWiki', 'TracWiki'))
        cursor = self.db.cursor()
        cursor.execute("SELECT COUNT(*) FROM subscription_attribute")
        count = cursor.fetchone()
        self.assertEqual(count[0], 2)

        attr.delete(self.env, 1)
        # Make sure, that we really deleted the 1st attribute.
        cursor.execute("SELECT target FROM subscription_attribute")
        for attribute in cursor.fetchone():
            self.assertEqual(attribute, 'TracWiki')
        cursor.execute("SELECT COUNT(*) FROM subscription_attribute")
        count = cursor.fetchone()
        self.assertEqual(count[0], 1)
        # Deleting non-existent subscriptions is handled gracefully.
        attr.delete(self.env, 1)
Example #2
0
 def test_init(self):
     # Examine properties of the initialized objekt.
     fields = ('id', 'sid', 'authenticated', 'class', 'realm', 'target')
     attr = SubscriptionAttribute(self.env)
     for field in fields:
         self.assertEqual(attr[field], None)