kytos-ng / kytos-end-to-end-tests

Kytos End-to-End Tests
0 stars 10 forks source link

Creation of a new circuit returns an invalid response code (201) #77

Closed ArturoQuintana closed 3 years ago

ArturoQuintana commented 3 years ago

The action to create a new circuit through a Post API call using a wrong payload returns an invalid response given the nature of the process. In this case, the payload contains an only-read attribute ("active": True), and despite this setting, the call is returning 201 when it should be 400 based on the expected behavior.

See example:

 def test_025_should_fail_due_to_invalid_attribute_on_payload(self):
        payload = {
            "name": "my evc1",
            "enabled": True,
            "uni_a": {
                "interface_id": "00:00:00:00:00:00:00:01:1",
                "tag": {
                    "tag_type": 1,
                    "value": 101
                }
            },
            "uni_z": {
                "interface_id": "00:00:00:00:00:00:00:02:1",
                "tag": {
                    "tag_type": 1,
                    "value": 101
                }
            },
            "primary_path": [
                {"endpoint_a": {"id": "00:00:00:00:00:00:00:01:3"},
                 "endpoint_b": {"id": "00:00:00:00:00:00:00:02:2"}}
            ],
            "dynamic_backup_path": True,
            "active": True,
        }

        api_url = KYTOS_API + '/mef_eline/v2/evc/'
        response = requests.post(api_url, data=json.dumps(payload), headers={'Content-type': 'application/json'})
        assert response.status_code == 400

Source

ArturoQuintana commented 3 years ago

Transferred to mef_eline https://github.com/kytos-ng/mef_eline/issues/39