コード例 #1
0
    def test_yml_delete_should_remove_value_with_success(self):
        create_test_yml_file()
        ref = 'test.configuration.time'
        self.assertIsNotNone(yml_get(tmp_path, ref))

        yml_delete(tmp_path, ref)

        self.assertIsNone(yml_get(tmp_path, ref))
コード例 #2
0
        def test(yml_refs, value):
            append_result = yml_append(tmp_path, (yml_refs, value))
            newly_updated = yml_load(tmp_path)
            value_after_append = yml_get(tmp_path, yml_refs)

            self.assertEqual(append_result, newly_updated)
            self.assertTrue(str(value_after_append).__contains__(str(value)))
コード例 #3
0
    def test_yml_change_should_correctly_change_value_of_yml_property(self):
        create_test_yml_file()
        ref = 'test.configuration.date'
        new_value = '09-11-2019'
        file_result = yml_change(tmp_path, (ref, new_value))

        self.assertTrue(file_result.content.__contains__(new_value))
        self.assertEqual(new_value, yml_get(tmp_path, ref))
コード例 #4
0
    def test_yml_get_should_return_None_if_refs_are_zero_length(self):
        refs = ''
        result = yml_get(tmp_path, refs)

        self.assertEqual(None, result)
コード例 #5
0
    def test_yml_get_should_return_correct_value_if_refs_path_is_long(self):
        refs = 'property.deep.nested.test.is.this.will.work'
        result = yml_get(tmp_path, refs)

        self.assertEqual('works well!', result)
コード例 #6
0
    def test_yml_get_should_return_None_if_property_not_exist(self):
        refs = 'test.not.exist'
        result = yml_get(tmp_path, refs)

        self.assertEqual(None, result)
コード例 #7
0
    def test_yml_get_should_correctly_fetch_one_requested_property(self):
        refs = 'test.configuration.date'
        result = yml_get(tmp_path, refs)

        self.assertEqual('08-11-2019', result)
コード例 #8
0
 def get_property(self, refs):
     if self._config_file_path is not None and refs is not None:
         return yml_get(self._config_file_path, refs)