Esempio n. 1
0
 def test1(self):
     s = MemoryStore()
     
     s.storeuser('*****@*****.**', {'field1':'value1', 'field2':'value2'})
     
     fields = s.readuser('*****@*****.**')
     
     self.assertDictEqual(fields, {'field1':'value1', 'field2':'value2'})
     self.assertTrue(s.userexists('*****@*****.**'))
     
     s.storeuser('*****@*****.**', {'field3':'value3'})
     
     fields = s.readuser('*****@*****.**')
     
     self.assertDictEqual(fields, {'field3':'value3'})
     self.assertTrue(s.userexists('*****@*****.**'))
     
     s.deluser('*****@*****.**')
     
     self.assertFalse(s.userexists('*****@*****.**'))
Esempio n. 2
0
    def test5(self):
        ms = MemoryStore()
        ub = UserBase(ms)
        
        u = ub.newuser('someuid')
        u.setfield('field', 'value')
        
        fields = ms.readuser('someuid')
        self.assertIsNone(fields)
        
        ub.store_changes()
        
        fields = ms.readuser('someuid')
        self.assertEqual(fields.get('field'), 'value')

        u.setfield('field', 'newvalue')
        ub.store_changes()
        
        fields = ms.readuser('someuid')
        self.assertEqual(fields.get('field'), 'newvalue')