Пример #1
0
    def test_json_file_codec(self):
        data = {"Section1": 's1v1',
                "Section2": {"s2k1": '1',
                             "s2k2": 'True'},
                "Section3": {"Section4": {"s4k1": '3.1415926535',
                                          "s4k2": None}}
                }

        self._test_file_codec(data, JsonCodec())
Пример #2
0
 def write(self, filename):
     self.clear_file(filename)
     credentials = {'username': self.username,
                    'password': self.password}
     operating_system.write_file(filename, credentials, codec=JsonCodec())
     operating_system.chmod(filename, operating_system.FileMode.SET_USR_RW)
Пример #3
0
 def read(self, filename):
     credentials = operating_system.read_file(filename, codec=JsonCodec())
     self.username = credentials['username']
     self.password = credentials['password']