diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fixtures/test.gitconfig | 9 | ||||
-rw-r--r-- | tests/test_git_config.py | 17 |
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/fixtures/test.gitconfig b/tests/fixtures/test.gitconfig index 9b3f2574..e3f51db3 100644 --- a/tests/fixtures/test.gitconfig +++ b/tests/fixtures/test.gitconfig | |||
@@ -11,3 +11,12 @@ | |||
11 | intk = 10k | 11 | intk = 10k |
12 | intm = 10m | 12 | intm = 10m |
13 | intg = 10g | 13 | intg = 10g |
14 | [repo "syncstate.main"] | ||
15 | synctime = 2021-07-29T19:18:53.201328Z | ||
16 | version = 1 | ||
17 | [repo "syncstate.sys"] | ||
18 | argv = ['/usr/bin/pytest-3'] | ||
19 | [repo "syncstate.superproject"] | ||
20 | test = false | ||
21 | [repo "syncstate.options"] | ||
22 | verbose = true | ||
diff --git a/tests/test_git_config.py b/tests/test_git_config.py index 3300c12f..44ff5974 100644 --- a/tests/test_git_config.py +++ b/tests/test_git_config.py | |||
@@ -104,6 +104,23 @@ class GitConfigReadOnlyTests(unittest.TestCase): | |||
104 | for key, value in TESTS: | 104 | for key, value in TESTS: |
105 | self.assertEqual(value, self.config.GetInt('section.%s' % (key,))) | 105 | self.assertEqual(value, self.config.GetInt('section.%s' % (key,))) |
106 | 106 | ||
107 | def test_GetSyncAnalysisStateData(self): | ||
108 | """Test config entries with a sync state analysis data.""" | ||
109 | superproject_logging_data = {} | ||
110 | superproject_logging_data['test'] = False | ||
111 | options = type('options', (object,), {})() | ||
112 | options.verbose = 'true' | ||
113 | TESTS = ( | ||
114 | ('superproject.test', 'false'), | ||
115 | ('options.verbose', 'true'), | ||
116 | ('main.version', '1'), | ||
117 | ) | ||
118 | self.config.UpdateSyncAnalysisState(options, superproject_logging_data) | ||
119 | sync_data = self.config.GetSyncAnalysisStateData() | ||
120 | for key, value in TESTS: | ||
121 | self.assertEqual(sync_data[f'{git_config.SYNC_STATE_PREFIX}{key}'], value) | ||
122 | self.assertTrue(sync_data[f'{git_config.SYNC_STATE_PREFIX}main.synctime']) | ||
123 | |||
107 | 124 | ||
108 | class GitConfigReadWriteTests(unittest.TestCase): | 125 | class GitConfigReadWriteTests(unittest.TestCase): |
109 | """Read/write tests of the GitConfig class.""" | 126 | """Read/write tests of the GitConfig class.""" |