Add test for VALID_BLUEPRINT_NAME check

Blueprint names can only contain alphanumeric characters and the characters: ._-. This test checks that an api request to create a blueprint with invalid characters in its name will return an InvalidChars error.
This commit is contained in:
Jacob Kozol 2019-07-08 16:41:54 +02:00 committed by Lars Karlitski
parent 4174186c14
commit 38f1edd2aa
1 changed files with 1 additions and 4 deletions

View File

@ -3,8 +3,6 @@
import composertest
import requests
import subprocess
import json
class TestApi(composertest.ComposerTestCase):
"""Test Composer HTTP API"""
@ -78,12 +76,11 @@ class TestApi(composertest.ComposerTestCase):
"modules": [],
"groups": []
}
r = self.request("POST", "/api/v0/blueprints/new", json=invalid_blueprint, check=False)
self.assertEqual(r.status_code, 400)
self.assertEqual(r.json(), {
"status": False,
"errors": [{ "id": "InvalidChars", "code": 400, "msg": "Invalid characters in API path" }]
"errors": [{ "id": "InvalidChars", "msg": "Invalid characters in API path" }]
})