diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/fixtures/test.gitconfig | 10 | ||||
| -rw-r--r-- | tests/test_git_config.py | 38 |
2 files changed, 19 insertions, 29 deletions
diff --git a/tests/fixtures/test.gitconfig b/tests/fixtures/test.gitconfig index b178cf60..9b3f2574 100644 --- a/tests/fixtures/test.gitconfig +++ b/tests/fixtures/test.gitconfig | |||
| @@ -11,13 +11,3 @@ | |||
| 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-09-14T17:23:43.537338Z | ||
| 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 | ||
| 23 | mpupdate = false | ||
diff --git a/tests/test_git_config.py b/tests/test_git_config.py index faf12a2e..a4fad9ef 100644 --- a/tests/test_git_config.py +++ b/tests/test_git_config.py | |||
| @@ -104,25 +104,6 @@ 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 | options.mp_update = 'false' | ||
| 114 | TESTS = ( | ||
| 115 | ('superproject.test', 'false'), | ||
| 116 | ('options.verbose', 'true'), | ||
| 117 | ('options.mpupdate', 'false'), | ||
| 118 | ('main.version', '1'), | ||
| 119 | ) | ||
| 120 | self.config.UpdateSyncAnalysisState(options, superproject_logging_data) | ||
| 121 | sync_data = self.config.GetSyncAnalysisStateData() | ||
| 122 | for key, value in TESTS: | ||
| 123 | self.assertEqual(sync_data[f'{git_config.SYNC_STATE_PREFIX}{key}'], value) | ||
| 124 | self.assertTrue(sync_data[f'{git_config.SYNC_STATE_PREFIX}main.synctime']) | ||
| 125 | |||
| 126 | 107 | ||
| 127 | class GitConfigReadWriteTests(unittest.TestCase): | 108 | class GitConfigReadWriteTests(unittest.TestCase): |
| 128 | """Read/write tests of the GitConfig class.""" | 109 | """Read/write tests of the GitConfig class.""" |
| @@ -187,6 +168,25 @@ class GitConfigReadWriteTests(unittest.TestCase): | |||
| 187 | config = self.get_config() | 168 | config = self.get_config() |
| 188 | self.assertIsNone(config.GetBoolean('foo.bar')) | 169 | self.assertIsNone(config.GetBoolean('foo.bar')) |
| 189 | 170 | ||
| 171 | def test_GetSyncAnalysisStateData(self): | ||
| 172 | """Test config entries with a sync state analysis data.""" | ||
| 173 | superproject_logging_data = {} | ||
| 174 | superproject_logging_data['test'] = False | ||
| 175 | options = type('options', (object,), {})() | ||
| 176 | options.verbose = 'true' | ||
| 177 | options.mp_update = 'false' | ||
| 178 | TESTS = ( | ||
| 179 | ('superproject.test', 'false'), | ||
| 180 | ('options.verbose', 'true'), | ||
| 181 | ('options.mpupdate', 'false'), | ||
| 182 | ('main.version', '1'), | ||
| 183 | ) | ||
| 184 | self.config.UpdateSyncAnalysisState(options, superproject_logging_data) | ||
| 185 | sync_data = self.config.GetSyncAnalysisStateData() | ||
| 186 | for key, value in TESTS: | ||
| 187 | self.assertEqual(sync_data[f'{git_config.SYNC_STATE_PREFIX}{key}'], value) | ||
| 188 | self.assertTrue(sync_data[f'{git_config.SYNC_STATE_PREFIX}main.synctime']) | ||
| 189 | |||
| 190 | 190 | ||
| 191 | if __name__ == '__main__': | 191 | if __name__ == '__main__': |
| 192 | unittest.main() | 192 | unittest.main() |
