def test_create_forest(self): conn = Connection(tc.hostname, HTTPDigestAuth(tc.admin, tc.password)) host = Host.list_hosts(conn)[0] forest = Forest( "test-forest-simple-create", host=host.host_name(), large_data_directory=ds.large_data_directory, fast_data_directory=ds.fast_data_directory, ) forest.create(conn) forest = Forest.lookup("test-forest-simple-create", conn) try: self.assertIsNotNone(forest) self.assertEqual("test-forest-simple-create", forest.name()) self.assertEqual(host.host_name(), forest.host()) self.assertEqual(ds.large_data_directory, forest.large_data_directory()) self.assertEqual(ds.fast_data_directory, forest.fast_data_directory()) finally: forest.remove(conn)
def test_create_single_detailed_forest(self): """ Test the following scenario: The database is given a forest object. It should create a forest with the given name. That forest should match the features of the datailed forest. """ conn = Connection(tc.hostname, HTTPDigestAuth(tc.admin, tc.password)) hosts = Host.list_hosts(conn) db = Database("detailed-forest-create-test-db", hosts[0].host_name()) forest = Forest("detailed-forest-create-forest1", host=hosts[0].host_name(), large_data_directory=ds.large_data_directory) db.set_forests([forest]) db.create(conn) forest = Forest.lookup("detailed-forest-create-forest1", conn) try: self.assertEqual("detailed-forest-create-forest1", forest.name()) self.assertEqual(ds.large_data_directory, forest.large_data_directory()) finally: db.remove(conn)
def test_getters_and_setters(self): forest = Forest("Foo", host="bar", data_directory="/foo/bar", large_data_directory="/foo/bar", fast_data_directory="/foo/bar") self.assertEqual(forest.name(), "Foo") forest.set_availability("offline") self.assertEqual("offline", forest.availability()) with self.assertRaises(ValidationError): forest.set_availability("foo") self.assertEqual("bar", forest.host()) self.assertEqual("/foo/bar", forest.data_directory()) forest.set_database("foo") self.assertEqual("foo", forest.database()) self.assertEqual("/foo/bar", forest.fast_data_directory()) self.assertEqual("/foo/bar", forest.large_data_directory())
def test_create_forest(self): conn = Connection(tc.hostname, HTTPDigestAuth(tc.admin, tc.password)) host = Host.list_hosts(conn)[0] forest = Forest("test-forest-simple-create", host=host.host_name(), large_data_directory=ds.large_data_directory, fast_data_directory=ds.fast_data_directory, ) forest.create(conn) forest = Forest.lookup("test-forest-simple-create", conn) try: self.assertIsNotNone(forest) self.assertEqual("test-forest-simple-create", forest.name()) self.assertEqual(host.host_name(), forest.host()) self.assertEqual(ds.large_data_directory, forest.large_data_directory()) self.assertEqual(ds.fast_data_directory, forest.fast_data_directory()) finally: forest.remove(conn)
def test_getters_and_setters(self): forest = Forest("Foo", host="bar", data_directory=ds.data_directory, large_data_directory=ds.large_data_directory, fast_data_directory=ds.fast_data_directory) self.assertEqual(forest.name(), "Foo") forest.set_availability("offline") self.assertEqual("offline", forest.availability()) with self.assertRaises(ValidationError): forest.set_availability("foo") self.assertEqual("bar", forest.host()) self.assertEqual(ds.data_directory, forest.data_directory()) forest.set_database("foo") self.assertEqual("foo", forest.database()) self.assertEqual(ds.fast_data_directory, forest.fast_data_directory()) self.assertEqual(ds.large_data_directory, forest.large_data_directory())