Ejemplo n.º 1
0
    def test_getting(self):
        with FreshDatabase() as db:
            for k, v in test_items.iteritems():
                self.assertEqual(db.setsetting(k, v), [],
                                 msg='Failed to set (%s, %s)' % (k, v))

            for k, v in test_items.iteritems():
                self.assertEqual(db.getsetting(k),
                                 v,
                                 msg='Failed to get (%s)' % (k))
Ejemplo n.º 2
0
    def test_all_pairs(self):
        with FreshDatabase() as db:
            for k, v in test_items.iteritems():
                self.assertEqual(db.setsetting(k, v), [],
                                 msg='Failed to set (%s, %s)' % (k, v))

            ap = db.all_pairs()
            for k, v in test_items.iteritems():
                self.assertIn(k, ap, msg='Key (%s) not found in all_pairs' % k)
                self.assertEqual(
                    ap[k],
                    v,
                    msg='Value in all_pairs not equal to original item')
Ejemplo n.º 3
0
 def test_default_values(self):
     with FreshDatabase(test_items) as db:
         for k, v in test_items.iteritems():
             self.assertEqual(
                 db.getsetting(k),
                 v,
                 msg='Value added as default, different to original (%s)' %
                 k)
Ejemplo n.º 4
0
    def test_all_pairs_returntype(self):
        with FreshDatabase() as db:
            for k, v in test_items.iteritems():
                self.assertEqual(db.setsetting(k, v), [],
                                 msg='Failed to set (%s, %s)' % (k, v))

            self.assertIsInstance(db.all_pairs(),
                                  dict,
                                  msg='Output of all_pairs is not a dict')
Ejemplo n.º 5
0
    def test_replacement_setting(self):
        with FreshDatabase() as db:
            for k, v in test_items.iteritems():
                self.assertEqual(db.setsetting(k, v), [],
                                 msg='Failed to set (%s, %s)' % (k, v))

            for k, v in test_items_replacements.iteritems():
                self.assertEqual(db.setsetting(k, v), [],
                                 msg='Failed to set replacement (%s, %s)' %
                                 (k, v))