Пример #1
0
    def test_version_integer_conversion(self):
        self.assertEqual(1002003, Configuration.version_to_integer([1, 2, 3]))
        self.assertEqual(1000000, Configuration.version_to_integer([1]))
        self.assertEqual(1002003, Configuration.version_to_integer('1.2.3'))
        self.assertEqual(1000000, Configuration.version_to_integer('1'))
        self.assertEqual(1, Configuration.version_to_integer(1))

        self.assertEqual('1.2.3', Configuration.integer_to_version(1002003))
        self.assertEqual('1.2.0', Configuration.integer_to_version(1002000))
        self.assertEqual('1.0.0', Configuration.integer_to_version(1000000))
        self.assertEqual('0.1.2', Configuration.integer_to_version(1002))
        self.assertEqual('0.0.1', Configuration.integer_to_version(1))
Пример #2
0
 def _convert_to_redis_key(cls, configuration, branch):
     return 'configs_with_branch:{}:{}:{}:{}:{}:{}:{}:{}:{}'.format(
         configuration.platform or '*', '*' if configuration.is_simulator is None else (1 if configuration.is_simulator else 0),
         '*' if configuration.version is None else Configuration.integer_to_version(configuration.version),
         configuration.version_name or '*',
         configuration.architecture or '*', configuration.model or '*',
         configuration.style or '*', configuration.flavor or '*',
         branch,
     )