]> git.ipfire.org Git - people/ms/u-boot.git/blob - tools/binman/entry_test.py
Merge git://git.denx.de/u-boot-dm
[people/ms/u-boot.git] / tools / binman / entry_test.py
1 #
2 # Copyright (c) 2016 Google, Inc
3 # Written by Simon Glass <sjg@chromium.org>
4 #
5 # SPDX-License-Identifier: GPL-2.0+
6 #
7 # Test for the Entry class
8
9 import collections
10 import unittest
11
12 import entry
13
14 class TestEntry(unittest.TestCase):
15 def testEntryContents(self):
16 """Test the Entry bass class"""
17 base_entry = entry.Entry(None, None, None, read_node=False)
18 self.assertEqual(True, base_entry.ObtainContents())
19
20 def testUnknownEntry(self):
21 """Test that unknown entry types are detected"""
22 Node = collections.namedtuple('Node', ['name', 'path'])
23 node = Node('invalid-name', 'invalid-path')
24 with self.assertRaises(ValueError) as e:
25 entry.Entry.Create(None, node, node.name)
26 self.assertIn("Unknown entry type 'invalid-name' in node "
27 "'invalid-path'", str(e.exception))