Example #1
0
 def test_get_default_1(self):
     d = Definition({})
     self.assertEqual(d.get('name'), None)
Example #2
0
 def test_init_2(self):
     d = Definition({'name': 'test'})
     self.assertEqual(d.settings, {'name': 'test'})
Example #3
0
 def test_get(self):
     d = Definition({'name': 'test'})
     self.assertEqual(d.get('name'), 'test')
Example #4
0
 def test___str__(self):
     d = Definition()
     self.assertNotEqual(d.__str__(), None)
Example #5
0
 def test_init_1(self):
     d = Definition({})
     self.assertEqual(d.settings, {})
Example #6
0
 def test_set_override_false(self):
     d = Definition({'name': 'test'})
     d.set('name', 'This is a test name', override=False)
     self.assertEqual(d.get('name'), 'test')
Example #7
0
 def test_has_1(self):
     d = Definition({'name': 'test'})
     self.assertEqual(d.has('name'), True)
Example #8
0
 def test_sanity_check_ok_3(self):
     d = Definition({'register': 1, 'name': 'test'})
     d.set_requiered_field('name')
     self.assertEqual(d.sanity_check_ok(), True)
Example #9
0
 def test_sanity_check_ok_4(self):
     d = Definition({'register': 1})
     d.set_requiered_field('name')
     self.assertEqual(d.sanity_check_ok(), False)
Example #10
0
 def test_sanity_check_2(self):
     d = Definition()
     d.set_requiered_field('name')
     self.assertEqual(len(d.sanity_check()), 0)
Example #11
0
 def test_sanity_check_3(self):
     d = Definition({'register': 1})
     d.set_requiered_field('name')
     self.assertEqual(len(d.sanity_check()), 1)
Example #12
0
 def test_set_requiered_field(self):
     d = Definition()
     d.set_requiered_field('name')
     self.assertEqual(d.requiered_fields, ['name'])
Example #13
0
 def test_register(self):
     d = Definition({'name': 'test'})
     d.register()
     self.assertEqual(DM.filter(name='test').pop(), d)
Example #14
0
 def test_has_2(self):
     d = Definition({})
     self.assertEqual(d.has('name'), False)
Example #15
0
 def test_set_default_3(self):
     d = Definition({})
     d.set_default('name', 'test')
     self.assertEqual(d.get('name'), 'test')
Example #16
0
 def test_load_defaults_2(self):
     d = Definition({'name': 'test'})
     d.set_default('name', 'This is a test')
     d.load_defaults()
     self.assertEqual(d.settings, {'name': 'test'})
Example #17
0
 def test_set(self):
     d = Definition({'name': 'This is a test name'})
     d.set('name', 'test')
     self.assertEqual(d.get('name'), 'test')
Example #18
0
 def test_inheritance(self):
     d = Definition()
     self.assertEqual(d.load_inheritance(), None)
Example #19
0
 def test_load_settings_2(self):
     d = Definition({'name': 'test'})
     d.load_settings({'name': 'This is a test name'})
     self.assertEqual(d.settings, {'name': 'test'})
Example #20
0
 def test_load_settings_3(self):
     d = Definition({'name': 'test'})
     d.load_settings({'name': 'This is a test name'}, override=True)
     self.assertEqual(d.settings, {'name': 'This is a test name'})