

def test_save_default_configuration(self):
    app = 'hive'
    is_default = True
    properties = [{
        'multiple': True,
        'value': [],
        'nice_name': 'Settings',
        'key': 'settings',
        'help_text': 'Impala configuration properties.',
        'type': 'settings',
        'options': [],
    }]
    configs = DefaultConfiguration.objects.filter(app=app, is_default=is_default)
    assert_equal(configs.count(), 0)
    response = self.client.post('/desktop/api/configurations/save', {
        'app': 'hive',
        'properties': json.dumps(properties),
        'is_default': is_default,
    })
    content = json.loads(response.content)
    assert_equal(content['status'], 0, content)
    assert_true(('configuration' in content), content)
    config = DefaultConfiguration.objects.get(app=app, is_default=is_default)
    assert_equal(config.properties_list, properties, config.properties_list)
    properties = {
        'settings': [{
            'key': 'hive.execution.engine',
            'value': 'mr',
        }],
    }
    response = self.client.post('/desktop/api/configurations/save', {
        'app': 'hive',
        'properties': json.dumps(properties),
        'is_default': is_default,
    })
    content = json.loads(response.content)
    assert_equal(content['status'], 0, content)
    assert_true(('configuration' in content), content)
    config = DefaultConfiguration.objects.get(app=app, is_default=is_default)
    assert_equal(config.properties_list, properties, config.properties_list)

dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/configuration/tests.py TestDefaultConfiguration.test_save_default_configuration/original