def _verify_instance_creation_for(self, host_controller_class): mock_host_controller = self.mox.CreateMock(host_controller_class) mock_host_controller.feedback = self.mock_feedback self.mox.ReplayAll() data_populator = RSRDataPopulator.create_with(TemplateLoader.load_database_credentials(), self.deployment_host_config, mock_host_controller) self.assertIsInstance(data_populator, RSRDataPopulator)
def _can_create_instance_for(self, host_controller_class): database_credentials = TemplateLoader.load_database_credentials() mock_host_controller = self.mox.CreateMock(host_controller_class) mock_host_controller.feedback = self.mock_feedback mock_host_controller.sudo('chmod a+w %s' % self.data_retriever_config.rsr_log_file_path) self.mox.ReplayAll() self.assertIsInstance(RSRDataRetriever.create_with(database_credentials, mock_host_controller), RSRDataRetriever)
def setUp(self): super(SQLStatementExecutorTest, self).setUp() database_credentials = TemplateLoader.load_database_credentials() self.expected_admin_credentials = "--user='******' --password='******'" % (database_credentials.admin_user, database_credentials.admin_password) self.mock_feedback = self.mox.CreateMock(ExecutionFeedback) self.mock_host_controller = self.mox.CreateMock(RemoteHostController) self.mock_host_controller.feedback = self.mock_feedback self.statement_executor = SQLStatementExecutor(database_credentials, self.mock_host_controller)
def test_can_create_instance(self): """fab.tests.database.mysql.database_admin_command_test Can create a DatabaseAdminCommand instance""" database_credentials = TemplateLoader.load_database_credentials() mock_host_controller = self.mox.CreateMock(RemoteHostController) mock_host_controller.feedback = self.mock_feedback self.mox.ReplayAll() self.assertIsInstance(DatabaseAdminCommand.create_with(database_credentials, mock_host_controller), DatabaseAdminCommand)
def setUp(self): super(DatabaseHostTest, self).setUp() self.deployment_host_config = CIDeploymentHostConfig.for_test() self.database_credentials = TemplateLoader.load_database_credentials() self.database_config = RSRDatabaseConfig(self.database_credentials, self.deployment_host_config) self.mock_settings_verifier = self.mox.CreateMock(RSRSettingsVerifier) self.mock_database_admin = self.mox.CreateMock(DatabaseAdmin) self.database_host = DatabaseHost(self.mock_settings_verifier, self.database_config, self.mock_database_admin)
def _verify_instance_creation_for(self, host_controller_class): mock_host_controller = self.mox.CreateMock(host_controller_class) mock_host_controller.feedback = self.mock_feedback self.mox.ReplayAll() data_populator = RSRDataPopulator.create_with( TemplateLoader.load_database_credentials(), self.deployment_host_config, mock_host_controller) self.assertIsInstance(data_populator, RSRDataPopulator)
def test_can_read_database_credentials_with_given_credentials_reader(self): """fab.tests.config.rsr.credentials.database_credentials_test Can read database credentials with a given credentials reader""" expected_credentials_data = TemplateLoader.load_database_credentials_data() mock_credentials_reader = self.mox.CreateMock(CredentialsFileReader) mock_credentials_reader.read_deployed_credentials(DatabaseCredentials.DATABASE_CREDENTIALS_FILE_NAME).AndReturn(expected_credentials_data) self.mox.ReplayAll() self.assertEqual(DatabaseCredentials(expected_credentials_data), DatabaseCredentials.read_with(mock_credentials_reader))
def test_can_create_instance_for_remote_host(self): """fab.tests.host.data_retrieval_host_test Can create a DataRetrievalHost instance for a remote host""" mock_remote_host_controller = self.mox.CreateMock(RemoteHostController) mock_remote_host_controller.feedback = self.mox.CreateMock(ExecutionFeedback) mock_remote_host_controller.sudo('chmod a+w %s' % RSRDataRetrieverConfig(DataHostPaths()).rsr_log_file_path) self.mox.ReplayAll() self.assertIsInstance(DataRetrievalHost.create_with(TemplateLoader.load_database_credentials(), mock_remote_host_controller), DataRetrievalHost)
def test_can_create_instance(self): """fab.tests.database.mysql.database_admin_test Can create a DatabaseAdmin instance""" deployment_host_config = CIDeploymentHostConfig.for_test() database_credentials = TemplateLoader.load_database_credentials() mock_host_controller = self.mox.CreateMock(RemoteHostController) mock_host_controller.feedback = self.mock_feedback self.mox.ReplayAll() self.assertIsInstance(DatabaseAdmin.create_with(database_credentials, deployment_host_config, mock_host_controller), DatabaseAdmin)
def _can_create_instance_for(self, host_controller_class): database_credentials = TemplateLoader.load_database_credentials() mock_host_controller = self.mox.CreateMock(host_controller_class) mock_host_controller.feedback = self.mock_feedback mock_host_controller.sudo('chmod a+w %s' % self.data_retriever_config.rsr_log_file_path) self.mox.ReplayAll() self.assertIsInstance( RSRDataRetriever.create_with(database_credentials, mock_host_controller), RSRDataRetriever)
def setUp(self): super(DataHandlerTest, self).setUp() database_credentials = TemplateLoader.load_database_credentials() self.expected_admin_credentials = "--user='******' --password='******'" % ( database_credentials.admin_user, database_credentials.admin_password) self.mock_feedback = self.mox.CreateMock(ExecutionFeedback) self.mock_host_controller = self.mox.CreateMock(RemoteHostController) self.mock_host_controller.feedback = self.mock_feedback self.data_handler = DataHandler(database_credentials, self.mock_host_controller)
def test_can_create_instance(self): """fab.tests.database.mysql.database_admin_command_test Can create a DatabaseAdminCommand instance""" database_credentials = TemplateLoader.load_database_credentials() mock_host_controller = self.mox.CreateMock(RemoteHostController) mock_host_controller.feedback = self.mock_feedback self.mox.ReplayAll() self.assertIsInstance( DatabaseAdminCommand.create_with(database_credentials, mock_host_controller), DatabaseAdminCommand)
def test_can_create_instance(self): """fab.tests.database.mysql.database_admin_test Can create a DatabaseAdmin instance""" deployment_host_config = CIDeploymentHostConfig.for_test() database_credentials = TemplateLoader.load_database_credentials() mock_host_controller = self.mox.CreateMock(RemoteHostController) mock_host_controller.feedback = self.mock_feedback self.mox.ReplayAll() self.assertIsInstance( DatabaseAdmin.create_with(database_credentials, deployment_host_config, mock_host_controller), DatabaseAdmin)
def test_can_read_database_credentials_with_given_credentials_reader(self): """fab.tests.config.rsr.credentials.database_credentials_test Can read database credentials with a given credentials reader""" expected_credentials_data = TemplateLoader.load_database_credentials_data( ) mock_credentials_reader = self.mox.CreateMock(CredentialsFileReader) mock_credentials_reader.read_deployed_credentials( DatabaseCredentials.DATABASE_CREDENTIALS_FILE_NAME).AndReturn( expected_credentials_data) self.mox.ReplayAll() self.assertEqual( DatabaseCredentials(expected_credentials_data), DatabaseCredentials.read_with(mock_credentials_reader))
def test_can_create_instance_for_remote_host(self): """fab.tests.host.data_retrieval_host_test Can create a DataRetrievalHost instance for a remote host""" mock_remote_host_controller = self.mox.CreateMock(RemoteHostController) mock_remote_host_controller.feedback = self.mox.CreateMock( ExecutionFeedback) mock_remote_host_controller.sudo( 'chmod a+w %s' % RSRDataRetrieverConfig(DataHostPaths()).rsr_log_file_path) self.mox.ReplayAll() self.assertIsInstance( DataRetrievalHost.create_with( TemplateLoader.load_database_credentials(), mock_remote_host_controller), DataRetrievalHost)
def setUp(self): super(RSRDatabaseConfigTest, self).setUp() self.database_credentials = TemplateLoader.load_database_credentials() self.database_config = RSRDatabaseConfig(self.database_credentials, 'some_rsrdb')
def setUp(self): super(DatabaseCredentialsTest, self).setUp() self.database_credentials = DatabaseCredentials( TemplateLoader.load_database_credentials_data())
def setUp(self): super(DatabaseCredentialsTest, self).setUp() self.database_credentials = DatabaseCredentials(TemplateLoader.load_database_credentials_data())