def test_get_snapshot_status_choices_without_current(self): current_status = {'status': 'available'} status_choices = forms.populate_status_choices(current_status, forms.STATUS_CHOICES) self.assertEqual(len(status_choices), len(forms.STATUS_CHOICES)) self.assertNotIn(current_status['status'], [status[0] for status in status_choices])
def test_get_volume_status_choices_without_current(self): current_status = {'status': 'available'} status_choices = forms.populate_status_choices(current_status, forms.STATUS_CHOICES) self.assertEqual(len(status_choices), len(forms.STATUS_CHOICES)) self.assertNotIn(current_status['status'], [status[0] for status in status_choices])
def __init__(self, request, *args, **kwargs): super(UpdateStatus, self).__init__(request, *args, **kwargs) initial = kwargs.get("initial", {}) self.fields["status"].choices = populate_status_choices(initial, STATUS_CHOICES)
def __init__(self, request, *args, **kwargs): super(UpdateStatus, self).__init__(request, *args, **kwargs) initial = kwargs.get('initial', {}) self.fields['status'].choices = ( populate_status_choices(initial, STATUS_CHOICES))
def test_get_volume_status_choices_without_current(self): current_status = {"status": "available"} status_choices = forms.populate_status_choices(current_status, forms.STATUS_CHOICES) self.assertEqual(len(status_choices), len(forms.STATUS_CHOICES)) self.assertNotIn(current_status["status"], [status[0] for status in status_choices])