def test_read(self, configuration_file: ConfigurationFile): configuration: ConfigurationProperty = ConfigurationProperty( '1', 'key', 'value') configuration_file.save([configuration]) lines = configuration_file.read() assert len(lines) == 1 and lines[0] == ('0', 'key', 'value')
def test_save(self, configuration_file: ConfigurationFile): test_value = 'test_value' configuration: ConfigurationProperty = ConfigurationProperty( '1', 'test_key', test_value) configuration_file.save([configuration]) with open(configuration_file.path, 'r') as f: text = f.read() assert test_value in text
def test_assign_op(self, configuration_file: ConfigurationFile): configuration: ConfigurationProperty = ConfigurationProperty( '1', 'key', 'value') configuration_file.save([configuration]) with open(configuration_file.path, 'r') as f: text = f.read() assert 'key=value' in text os.remove(configuration_file.path) new_configuration_file = ConfigurationFile(configuration_file.path, ' ') new_configuration_file.read() new_configuration_file.save([configuration]) with open(new_configuration_file.path, 'r') as f: text = f.read() assert 'key=value' not in text assert 'key value' in text