Read raw data and add a submit-build.sh test script

Signed-off-by: Petr Šabata <contyk@redhat.com>
This commit is contained in:
Petr Šabata
2016-07-08 12:32:28 +02:00
parent 4b91b519d2
commit 4da929ac93
4 changed files with 9 additions and 11 deletions

View File

@@ -62,7 +62,7 @@ def submit_build():
" new build", 403)
try:
r = json.loads(request.data.decode('utf-8'))
r = json.loads(request.get_data().decode("utf-8"))
except:
return "Invalid JSON submitted", 400
if "scmurl" not in r:

3
submit-build.json Normal file
View File

@@ -0,0 +1,3 @@
{
"scmurl": "git://pkgs.stg.fedoraproject.org/modules/testmodule.git?#020ea37251df5019fde9e7899d2f7d7a987dfbf5"
}

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env python3
""" A little script to test submitting a build. """
import requests
response = requests.post('http://127.0.0.1:5000/rida/module-builds/', json={
'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/core.git',
})
print("%r %s" % (response, response.text))

5
submit-build.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
echo "Submmiting a build of modules/testmodule, #020ea37251df5019fde9e7899d2f7d7a987dfbf5"
echo "Using https://localhost:5000/rida/module-builds/"
echo "NOTE: You need to be a Fedora packager for this to work"
curl --cert ~/.fedora.cert -k -H "Content-Type: text/json" --data @submit-build.json https://localhost:5000/rida/module-builds/