예제 #1
0
    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')
예제 #2
0
 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
예제 #3
0
 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