예제 #1
0
 def test_upgrade(self):
     ''' Test loading old configs is equivalent to loading new ones.
     '''
     new = Config(pathlib.Path())
     old = Config(pathlib.Path())
     
     new.decode(vec_cfg)
     old.decode(vec_cfg_depr)
     
     self.assertEqual(new, old)
예제 #2
0
 def test_decode(self):
     ''' Test decoding both as round-trip and against a test vector.
     '''
     predecoded = obj_cfg
     decoded = Config(pathlib.Path())
     decoded.decode(vec_cfg)
     
     freshdump_1 = predecoded.encode()
     freshdump_2 = decoded.encode()
     
     self.assertEqual(freshdump_1, freshdump_2)
     self.assertEqual(freshdump_2, vec_cfg)
예제 #3
0
 def test_encode(self):
     ''' Test encoding both as round-trip and against a test vector.
     '''
     preencoded = vec_cfg
     encoded = obj_cfg.encode()
     
     freshconfig_1 = Config(pathlib.Path())
     freshconfig_2 = Config(pathlib.Path())
     
     freshconfig_1.decode(preencoded)
     freshconfig_2.decode(encoded)
     
     self.assertEqual(freshconfig_1, freshconfig_2)
     self.assertEqual(freshconfig_2, obj_cfg)