Esempio n. 1
0
	def test_default_options(self):
		unit = Unit("sample", {})
		self.assertEqual(unit.name, "sample")
		self.assertEqual(unit.type, "sample")
		self.assertTrue(unit.enabled)
		self.assertFalse(unit.replace)
		self.assertDictEqual(unit.options, {})
Esempio n. 2
0
	def test_parsing_options(self):
		unit = Unit("sample", {"type": "net", "enabled": True, "replace": True, "other": "foo"})
		self.assertEqual(unit.type, "net")
Esempio n. 3
0
	def test_option_custom(self):
		unit = Unit("sample", {"enabled": True, "type": "net", "custom": "value", "foo": "bar"})
		self.assertDictEqual(unit.options, {"custom": "value", "foo": "bar"})
		unit.options = {"hello": "world"}
		self.assertDictEqual(unit.options, {"hello": "world"})
Esempio n. 4
0
	def test_option_replace(self):
		unit = Unit("sample", {"replace": True})
		self.assertTrue(unit.replace)
Esempio n. 5
0
	def test_option_enabled(self):
		unit = Unit("sample", {"enabled": False})
		self.assertFalse(unit.enabled)
		unit.enabled = True
		self.assertTrue(unit.enabled)
Esempio n. 6
0
	def test_option_type(self):
		unit = Unit("sample", {"type": "net"})
		self.assertEqual(unit.type, "net")