blob: 85c4196892fc948b236210c45f0321d048b40043 [file] [log] [blame]
Simon Glass57454f42016-11-25 20:15:52 -07001#
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
9import collections
10import unittest
11
Simon Glass57454f42016-11-25 20:15:52 -070012class TestEntry(unittest.TestCase):
13 def testEntryContents(self):
14 """Test the Entry bass class"""
Simon Glassb3393262017-11-12 21:52:20 -070015 import entry
Simon Glass57454f42016-11-25 20:15:52 -070016 base_entry = entry.Entry(None, None, None, read_node=False)
17 self.assertEqual(True, base_entry.ObtainContents())
18
19 def testUnknownEntry(self):
20 """Test that unknown entry types are detected"""
Simon Glassb3393262017-11-12 21:52:20 -070021 import entry
Simon Glass57454f42016-11-25 20:15:52 -070022 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))