'Tests that the available partitions are populated correctly when editable_metadata_fields are called'

def test_available_partitions(self):

    self.assertEqual([], SplitTestDescriptor.user_partition_id.values)
    self.split_test_module.user_partition_id = SplitTestFields.no_partition_selected['value']
    self.split_test_module.editable_metadata_fields
    partitions = SplitTestDescriptor.user_partition_id.values
    self.assertEqual(1, len(partitions))
    self.assertEqual(SplitTestFields.no_partition_selected['value'], partitions[0]['value'])
    self.split_test_module.user_partitions = [UserPartition(0, 'first_partition', 'First    Partition', [Group('0', 'alpha'), Group('1', 'beta')], self.random_scheme), UserPartition(1, 'non_random_partition', 'Will    Not    Be    Returned', [Group('1', 'apple'), Group('2', 'banana')], self.non_random_scheme)]
    self.split_test_module.editable_metadata_fields
    partitions = SplitTestDescriptor.user_partition_id.values
    self.assertEqual(2, len(partitions))
    self.assertEqual(SplitTestFields.no_partition_selected['value'], partitions[0]['value'])
    self.assertEqual(0, partitions[1]['value'])
    self.assertEqual('first_partition', partitions[1]['display_name'])
    self.split_test_module.user_partition_id = 0
    self.split_test_module.editable_metadata_fields
    partitions = SplitTestDescriptor.user_partition_id.values
    self.assertEqual(1, len(partitions))
    self.assertEqual(0, partitions[0]['value'])
    self.assertEqual('first_partition', partitions[0]['display_name'])
    self.split_test_module.user_partition_id = 999
    self.split_test_module.editable_metadata_fields
    partitions = SplitTestDescriptor.user_partition_id.values
    self.assertEqual(2, len(partitions))
    self.assertEqual(SplitTestFields.no_partition_selected['value'], partitions[0]['value'])
    self.assertEqual(0, partitions[1]['value'])
    self.assertEqual('first_partition', partitions[1]['display_name'])
