def test_validGenerate(self): userlist = [x for x in range(len(self.temp_files))] cls = ListInfoGroup(userlist=userlist, subclass=TestInfoGroup, subargs={"basepath": self.temp_dir}) cls.generate() self.assertEqual(len(cls._instances), 4) self.assertEqual(cls._data, {}) for inst in cls._instances: self.assertEqual(inst._instances, []) self.assertEqual(inst._data, {})
def test_validUpdateInvalidClass(self): userlist = [x for x in range(len(self.temp_files))] cls = ListInfoGroup(userlist=userlist, subclass=unittest.TestCase, subargs={"basepath": self.temp_dir}) try: cls.generate() except: pass cls.update() self.assertEqual(cls._instances, []) self.assertEqual(cls._data, {})
def test_validGet(self): userlist = [x for x in range(len(self.temp_files))] cls = ListInfoGroup(userlist=userlist, subclass=TestInfoGroup, subargs={"basepath": self.temp_dir}) cls.generate() cls.update() outdict = cls.get() self.assertEqual(cls._data, {}) for inst in cls._instances: self.assertEqual(inst._instances, []) self.assertNotEqual(inst._data, {}) for i, key in enumerate(self.temp_files.keys()): for subkey in outdict[key]: self.assertEqual(key, subkey) self.assertEqual(key, outdict[key][subkey])