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())
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)
def read(self, filename): credentials = operating_system.read_file(filename, codec=JsonCodec()) self.username = credentials['username'] self.password = credentials['password']