def test_error(self, client): """ Ensure that we raise any server message to the user. """ client.adapter.register_uri('PUT', PROD + '/api/v1/releases/1017', status_code=500, json={'error': 'Some Error Here'}) differences = [('description', 'Red Hat Ceph Storage 4.0', 'Red Hat Ceph Storage 4.0 Is Cool')] with pytest.raises(ValueError) as err: edit_release(client, 1017, differences) assert err.value.args == ({'error': 'Some Error Here'}, )
def test_edit_release(self, client): client.adapter.register_uri('PUT', PROD + '/api/v1/releases/1017') # Very Cool differences = [('description', 'Red Hat Ceph Storage 4.0', 'Red Hat Ceph Storage 4.0 Is Cool')] edit_release(client, 1017, differences) history = client.adapter.request_history assert len(history) == 1 expected = { 'release': { 'description': 'Red Hat Ceph Storage 4.0 Is Cool', } } assert history[0].json() == expected
def test_state_machine_rule_set(self, client): """ Ensure that we send the ID number, not the name. CLOUDWF-298 """ client.adapter.register_uri('GET', PROD + '/workflow_rules', text=load_html('workflow_rules.html')) client.adapter.register_uri('PUT', PROD + '/api/v1/releases/1017') differences = [('state_machine_rule_set', None, 'Unrestricted')] edit_release(client, 1017, differences) history = client.adapter.request_history expected = { 'release': { 'state_machine_rule_set_id': 2, } } assert history[-1].json() == expected