INNER CODE UNIT · Python
upload_bad_test_charts
helm/chartmuseum · acceptance_tests/lib/ChartMuseum.py:92
def upload_bad_test_charts(self):
charts_endpoint = '%s/api/charts' % common.HELM_REPO_URL
testcharts_dir = os.path.join(self.rootdir, common.TESTBADCHARTS_DIR)
os.chdir(testcharts_dir)
for d in os.listdir('.'):
if not os.path.isdir(d):
continue
os.chdir(d)
tgzs = glob.glob('*.tgz')
for tgz in tgzs:
print(('Uploading bad test chart package "%s"' % tgz))
with open(tgz, 'rb') as f:
response = requests.post(url=charts_endpoint, data=f.read())
print(('POST %s' % charts_endpoint))
print(('HTTP STATUS: %s' % response.status_code))
print(('HTTP CONTENT: %s' % response.content))
self.http_status_code_should_be(400, response.status_code)