-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathgenerate_test.py
46 lines (38 loc) · 1.75 KB
/
generate_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import unittest
from unittest import mock
import restic
from restic.internal import generate
class GenerateTest(unittest.TestCase):
@mock.patch.object(generate.command_executor, 'execute')
def test_generate_with_no_parameters(self, mock_execute):
restic.generate()
mock_execute.assert_called_with(['restic', '--json', 'generate'])
@mock.patch.object(generate.command_executor, 'execute')
def test_generate_bash(self, mock_execute):
restic.generate(bash_completion_path='/tmp/dummy.path')
mock_execute.assert_called_with([
'restic', '--json', 'generate', '--bash-completion',
'/tmp/dummy.path'
])
@mock.patch.object(generate.command_executor, 'execute')
def test_generate_man(self, mock_execute):
restic.generate(man_directory='/tmp/man-dir')
mock_execute.assert_called_with(
['restic', '--json', 'generate', '--man', '/tmp/man-dir'])
@mock.patch.object(generate.command_executor, 'execute')
def test_generate_zsh(self, mock_execute):
restic.generate(zsh_completion_path='/tmp/dummy.path')
mock_execute.assert_called_with([
'restic', '--json', 'generate', '--zsh-completion',
'/tmp/dummy.path'
])
@mock.patch.object(generate.command_executor, 'execute')
def test_generate_all(self, mock_execute):
restic.generate(bash_completion_path='/tmp/dummy.path',
man_directory='/tmp/man-dir',
zsh_completion_path='/tmp/dummy.path')
mock_execute.assert_called_with([
'restic', '--json', 'generate', '--bash-completion',
'/tmp/dummy.path', '--man', '/tmp/man-dir', '--zsh-completion',
'/tmp/dummy.path'
])