Add unit tests for Chartbuilder handler

Change-Id: I9aefe07a3270a3740f879a5089ac8ab3b29b0964
This commit is contained in:
hifzasakhi 2018-02-14 22:21:04 +00:00
parent 3e1d9894e9
commit ff2c7d0951
1 changed files with 12 additions and 0 deletions

View File

@ -25,6 +25,7 @@ from supermutes.dot import dotify
import testtools
from armada.handlers.chartbuilder import ChartBuilder
from armada.exceptions import chartbuilder_exceptions
class ChartBuilderTestCase(testtools.TestCase):
@ -135,6 +136,17 @@ class ChartBuilderTestCase(testtools.TestCase):
resp = chartbuilder.get_metadata()
self.assertIsInstance(resp, Metadata)
def test_get_metadata_with_incorrect_file_invalid(self):
chart_dir = self.useFixture(fixtures.TempDir())
self.addCleanup(shutil.rmtree, chart_dir.path)
mock_chart = mock.Mock(source_dir=[chart_dir.path, ''])
chartbuilder = ChartBuilder(mock_chart)
self.assertRaises(
chartbuilder_exceptions.MetadataLoadException,
chartbuilder.get_metadata)
def test_get_files(self):
"""Validates that ``get_files()`` ignores 'Chart.yaml', 'values.yaml'
and 'templates' subfolder and all the files contained therein.