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

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

The creation of a new mef_eline's schedule returns an invalid response code #92

Closed ArturoQuintana closed 3 years ago

ArturoQuintana commented 3 years ago

The action to create a new mef_eline's schedule through a Post API call using a specific payload is returning an invalid response given the nature of the process. In the case the payload is an invalid JSON, given the fact that it is provided an unknown JSON's tag, the call is returning 201 when it should be 400 based on the expected behavior.

See example:

def test_create_schedule_by_date_with_invalid_json_format(self, circuit_id):

        # Schedule by date to next minute
        ts = datetime.now() + timedelta(seconds=60)
        schedule_time = ts.strftime("%Y-%m-%dT%H:%M:%S.000Z")

        payload = {
            "circuit_id": circuit_id,
            "schedule": {
                "unknown_tag": schedule_time
            }
        }

        # create circuit schedule
        api_url = KYTOS_API + '/mef_eline/v2/evc/schedule'
        response = requests.post(api_url, json=payload)
        assert response.status_code == 400

The same happens if the payload refers to an empty JSON. See example:

def test_create_schedule_by_date_with_empty_json(self, circuit_id):
        # Schedule by date to next minute
        payload = {
            "circuit_id": circuit_id,
            "schedule": {}
        }

        # create circuit schedule
        api_url = KYTOS_API + '/mef_eline/v2/evc/schedule'
        response = requests.post(api_url, json=payload)
        assert response.status_code == 400
ArturoQuintana commented 3 years ago

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