1 Feature: configuration model
3 when I work on tails-persistence-setup,
4 I want to ensure the configuration model works correctly.
6 Scenario: read from non-existing file
7 Given the file does not exist
8 When I create a ConfigFile object
9 Then the file should be created
10 And the list of lines in the file object should be empty
12 Scenario: read from empty file
13 Given the file is empty
14 When I create a ConfigFile object
15 Then the list of lines in the file object should be empty
17 Scenario: read from file that has a valid one-column line
18 Given the file has a valid one-column line
19 When I create a ConfigFile object
20 Then the list of options should be empty
22 Scenario: read from file that has a line with source option set
23 Given the file has a valid line with options 'source=bla'
24 When I create a ConfigFile object
25 Then the options list should contain 1 element
27 Scenario: read from file that has only a commented-out line
28 Given the file has only a commented-out line
29 When I create a ConfigFile object
30 Then the list of lines in the file object should be empty
32 Scenario: read from file that contains two valid two-columns lines and output
33 Given the file has two valid two-columns lines
34 When I create a ConfigFile object
35 Then the output string should contain 2 lines
37 Scenario: read and write file that contains two valid two-columns lines
38 Given the file has two valid two-columns lines
39 When I create a ConfigFile object
40 And I write in-memory configuration to file
41 Then the file should contain 2 lines
43 Scenario: read file that contains a line with options
44 Given the file has a valid line with options 'optA,optB'
45 When I create a ConfigFile object
46 Then the options list should contain 2 elements
47 And 'optA' should be part of the options list
48 And 'optB' should be part of the options list
50 Scenario: merge empty file with default presets
51 Given the file is empty
52 When I merge the presets and the file
53 Then the list of configuration atoms should contain 12 elements
54 And there should be 1 enabled configuration line
56 Scenario: merge non-empty file with enabled-by-default preset in
57 Given the file has the following content
59 /home/amnesia/Persistent source=Persistent
60 /home/amnesia/.myapp source=myapp
62 When I merge the presets and the file
63 Then the list of configuration atoms should contain 13 elements
64 And there should be 2 enabled configuration lines
66 Scenario: merge non-empty file with disabled-by-default preset in
67 Given the file has the following content
69 /home/amnesia/.gnupg source=gnupg
70 /home/amnesia/.myapp source=myapp
72 When I merge the presets and the file
73 Then the list of configuration atoms should contain 13 elements
74 And there should be 3 enabled configuration lines