Ejemplo n.º 1
0
 def test_unknown_codec(self):
     expected = 'Hello, world'
     with mock.patch('stacker.config.translators.file.read_value_from_path',
                     return_value=expected):
         with self.assertRaises(KeyError):
             get_file_value('bad:file://tmp/test')
Ejemplo n.º 2
0
 def test_get_file_value_parameterized_b64(self):
     expected = 'Hello, world'
     with mock.patch('stacker.config.translators.file.read_value_from_path',
                     return_value=expected):
         out = get_file_value('parameterized-b64:file://tmp/test')
         self.assertEqual(troposphere.Base64, type(out))
Ejemplo n.º 3
0
 def test_get_file_value_plain(self):
     expected = 'Hello, world'
     with mock.patch('stacker.config.translators.file.read_value_from_path',
                     return_value=expected):
         out = get_file_value('plain:file://tmp/test')
         self.assertEqual(expected, out)
Ejemplo n.º 4
0
 def test_get_file_value_b64(self):
     expected = 'Hello, world'
     with mock.patch('stacker.config.translators.file.read_value_from_path',
                     return_value=expected):
         out = get_file_value('base64:file://tmp/test')
         self.assertEqual(expected, base64.b64decode(out))
Ejemplo n.º 5
0
 def test_file_loaded(self):
     with mock.patch('stacker.config.translators.file.read_value_from_path',
                     return_value='') as amock:
         get_file_value('plain:file://tmp/test')
         amock.assert_called_with('file://tmp/test')