borgapi 0.6.1__py3-none-any.whl → 0.7.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,42 +0,0 @@
1
- """Test config command"""
2
- from .test_01_borgapi import BorgapiTests
3
-
4
-
5
- class ConfigTests(BorgapiTests):
6
- """Config command tests"""
7
-
8
- def setUp(self):
9
- super().setUp()
10
- self._create_default()
11
-
12
- def test_01_list(self):
13
- """List config values for repo"""
14
- output = self.api.config(self.repo, list=True)
15
- self._display("config list", output)
16
- self.assertType(output, str)
17
- repo_config = self._read_config(output)
18
- append_only = repo_config["repository"]["append_only"]
19
- self.assertEqual(append_only, "0", "Unexpected config value")
20
-
21
- def test_02_value(self):
22
- """List config value"""
23
- output = self.api.config(self.repo, "additional_free_space")
24
- self._display("config value", output)
25
- self.assertType(output, list)
26
- self.assertEqual(output[0], "0", "Unexpected config value")
27
-
28
- def test_03_change(self):
29
- """Change config values in repo"""
30
- self.api.config(self.repo, ("append_only", "1"))
31
- output = self.api.config(self.repo, list=True)
32
- repo_config = self._read_config(output)
33
- append_only = repo_config["repository"]["append_only"]
34
- self.assertEqual(append_only, "1", "Unexpected config value")
35
-
36
- def test_04_delete(self):
37
- """Delete config value from repo"""
38
- self.api.config(self.repo, "additional_free_space", delete=True)
39
- output = self.api.config(self.repo, list=True)
40
- repo_config = self._read_config(output)
41
- additional_free_space = repo_config["repository"]["additional_free_space"]
42
- self.assertEqual(additional_free_space, "False", "Unexpected config value")
@@ -1,24 +0,0 @@
1
- """Test benchmarck crud command"""
2
- from os import getenv
3
- from os.path import join
4
- from shutil import rmtree
5
-
6
- from .test_01_borgapi import BorgapiTests
7
-
8
-
9
- class BenchmarkCrudTests(BorgapiTests):
10
- """Benchmark Crud command tests"""
11
-
12
- def setUp(self):
13
- if getenv("BORGAPI_TEST_BENCHMARK_SKIP"):
14
- self.skipTest("Gotta go fast (only use for quick testing, not release)")
15
- super().setUp()
16
-
17
- def test_01_output(self):
18
- """Benchmark CRUD operations"""
19
- benchmark_dir = join(self.temp, "benchmark")
20
- self._make_clean(benchmark_dir)
21
- output = self.api.benchmark_crud(self.repo, benchmark_dir)
22
- self._display("benchmark crud", output)
23
- self.assertType(output, str)
24
- rmtree(benchmark_dir)
@@ -1,33 +0,0 @@
1
- """Test deff command"""
2
- from .test_01_borgapi import BorgapiTests
3
-
4
-
5
- class CompactTests(BorgapiTests):
6
- """Compact command tests"""
7
-
8
- def setUp(self):
9
- super().setUp()
10
- self._create_default()
11
- with open(self.file_3, "w") as fp:
12
- fp.write(self.file_3_text)
13
- self.api.create(f"{self.repo}::2", self.data)
14
- self.api.delete(self.archive)
15
-
16
- def test_01_output(self):
17
- """Compact string"""
18
- output = self.api.compact(self.repo)
19
- self._display("compact sting", output)
20
- self.assertNone(output)
21
-
22
- def test_02_output_verbose(self):
23
- """Compact string"""
24
- output = self.api.compact(self.repo, verbose=True)
25
- self._display("compact sting verbose", output)
26
- self.assertType(output, str)
27
-
28
- def test_03_output_json(self):
29
- """Compact json"""
30
- output = self.api.compact(self.repo, verbose=True, log_json=True)
31
- self._display("compact log json", output)
32
- self.assertAnyType(output, dict)
33
-
test/test_00_options.py DELETED
@@ -1,70 +0,0 @@
1
- """Test the Options module"""
2
- import unittest
3
-
4
- from borgapi import CommonOptions, ExclusionOptions
5
- from borgapi.options import OptionsBase
6
-
7
-
8
- class OptionsTests(unittest.TestCase):
9
- """Tests for the Options Dataclasses"""
10
-
11
- def test_convert(self):
12
- """Converting the name adds the dashes to the front and replaces underscores with dashes"""
13
- name = "test_name"
14
- converted = OptionsBase.convert_name(name)
15
- self.assertEqual(
16
- converted,
17
- "--test-name",
18
- "Name conversion does not produce expected ouput",
19
- )
20
-
21
- # pylint: disable=no-member,protected-access
22
- def test_defaults(self):
23
- """Defaults returns all the dataclass fields"""
24
- common = CommonOptions._defaults()
25
- exclusion = ExclusionOptions._defaults()
26
- self.assertEqual(
27
- len(common),
28
- len(CommonOptions.__dataclass_fields__.keys()),
29
- "Number of Common Options does not match expected number",
30
- )
31
- self.assertEqual(
32
- len(exclusion),
33
- len(ExclusionOptions.__dataclass_fields__.keys()),
34
- "Number of Exclusion Options does not match expected number",
35
- )
36
-
37
- def test_parse(self):
38
- """Parsing produces formatted args list from class instance"""
39
- expected_args = ["--warning", "--progress", "--log-json"]
40
- common_args = CommonOptions(warning=True, progress=True, log_json=True).parse()
41
- self.assertListEqual(
42
- common_args,
43
- expected_args,
44
- "Parsing boolean flags does not produce expected list output",
45
- )
46
-
47
- expected_args = [
48
- "--exclude",
49
- "foo",
50
- "--exclude",
51
- "bar",
52
- "--pattern",
53
- "baz",
54
- "--patterns-from",
55
- "spam/milk",
56
- ]
57
- exclusion_args = ExclusionOptions(
58
- exclude=["foo", "bar"],
59
- pattern="baz",
60
- patterns_from="spam/milk",
61
- ).parse()
62
- self.assertListEqual(
63
- exclusion_args,
64
- expected_args,
65
- "Parsing string flags does not produce expected output",
66
- )
67
-
68
-
69
- if __name__ == "__main__":
70
- unittest.main()