def test_foundry_default(self, fudged_open): fudged_open.is_callable().calls(fake_file_factory(fudged_data_files)) self.foundry.load() fry = self.foundry['fry'] self.assertIsInstance(fry, self.Crew) self.assertEqual(fry.id, 1) self.assertEqual(fry.name, u'philip j. fry') self.assertEqual(fry.birthday, datetime(1974, 8, 14)) self.assertEqual(fry.salary, Decimal('10000.00')) for k in ('leela', 'bender', 'farnsworth', 'hermes', 'zoidberg', 'amy'): self.assertIsInstance(self.foundry[k], self.Crew) planet_express_ship = self.foundry['planet-express-ship'] self.assertIsInstance(planet_express_ship, self.Ship) for k in ('fry', 'leela', 'bender'): self.assertIn(self.foundry[k], planet_express_ship.crew) self.assertEqual(self.foundry[k].ship, planet_express_ship)
def test_foundry_bad_yaml_local_settings(self, fudged_open): fudged_open.is_callable().calls( fake_file_factory(fudged_bad_yaml_data_files)) with self.assertRaises(ScannerError): self.foundry.load()
def test_foundry_copied_local_settings(self, fudged_open): fudged_open.is_callable().calls( fake_file_factory(fudged_copied_data_files)) with self.assertRaises(TypeError): self.foundry.load()
def test_foundry_bad_yaml_local_settings(self, fudged_open): fudged_open.is_callable().calls(fake_file_factory( fudged_bad_yaml_data_files)) with self.assertRaises(ScannerError): self.foundry.load()
def test_foundry_copied_local_settings(self, fudged_open): fudged_open.is_callable().calls(fake_file_factory( fudged_copied_data_files)) with self.assertRaises(TypeError): self.foundry.load()