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:
parent
4174186c14
commit
38f1edd2aa
@ -3,8 +3,6 @@
|
|||||||
import composertest
|
import composertest
|
||||||
import requests
|
import requests
|
||||||
import subprocess
|
import subprocess
|
||||||
import json
|
|
||||||
|
|
||||||
|
|
||||||
class TestApi(composertest.ComposerTestCase):
|
class TestApi(composertest.ComposerTestCase):
|
||||||
"""Test Composer HTTP API"""
|
"""Test Composer HTTP API"""
|
||||||
@ -78,12 +76,11 @@ class TestApi(composertest.ComposerTestCase):
|
|||||||
"modules": [],
|
"modules": [],
|
||||||
"groups": []
|
"groups": []
|
||||||
}
|
}
|
||||||
|
|
||||||
r = self.request("POST", "/api/v0/blueprints/new", json=invalid_blueprint, check=False)
|
r = self.request("POST", "/api/v0/blueprints/new", json=invalid_blueprint, check=False)
|
||||||
self.assertEqual(r.status_code, 400)
|
self.assertEqual(r.status_code, 400)
|
||||||
self.assertEqual(r.json(), {
|
self.assertEqual(r.json(), {
|
||||||
"status": False,
|
"status": False,
|
||||||
"errors": [{ "id": "InvalidChars", "code": 400, "msg": "Invalid characters in API path" }]
|
"errors": [{ "id": "InvalidChars", "msg": "Invalid characters in API path" }]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user