def parse_valid_partition_policy_test(self): """Parsing valid partition polices returns correct policies""" from azure.servicefabric.models.named_partition_scheme_description import NamedPartitionSchemeDescription #pylint: disable=line-too-long from azure.servicefabric.models.singleton_partition_scheme_description import SingletonPartitionSchemeDescription #pylint:disable=line-too-long from azure.servicefabric.models.uniform_int64_range_partition_scheme_description import UniformInt64RangePartitionSchemeDescription #pylint:disable=line-too-long res = sf_c.parse_partition_policy(True, ['test'], False, None, None, None, False) self.assertIsInstance(res, NamedPartitionSchemeDescription) self.assertEqual(res.count, 1) self.assertEqual(res.names, ['test']) res = sf_c.parse_partition_policy(False, None, True, 1, 5, 3, False) self.assertIsInstance(res, UniformInt64RangePartitionSchemeDescription) self.assertEqual(res.high_key, 5) self.assertEqual(res.low_key, 1) self.assertEqual(res.count, 3) res = sf_c.parse_partition_policy(False, None, False, None, None, None, True) self.assertIsInstance(res, SingletonPartitionSchemeDescription)
def parse_incomplete_partition_policy_int_test(self): """Parsing int partition policy with incomplete args raises error""" with self.assertRaises(CLIError): sf_c.parse_partition_policy(False, None, True, 0, 5, None, False)
def parse_multiple_partition_policy_test(self): """Parsing multiple different partition polices raises error""" with self.assertRaises(CLIError): sf_c.parse_partition_policy(True, ['test'], True, 0, 5, 3, True)
def parse_incomplete_partition_policy_named_scheme_test(self): """Parsing named partition policy with unspecified names raises error""" with self.assertRaises(CLIError): sf_c.parse_partition_policy(True, None, None, None, None, None, None)