Esempio n. 1
0
    def test_can_create_deployment_host_config_for_test_host(self):
        """fab.tests.config.rsr.data_host_config_test  Can create data host config"""

        data_host_config = DataHostConfig()

        self.assertEqual(DataHostPaths(), data_host_config.host_paths)
        self.assertEqual(SSHConnection.for_host(HostAlias.DATA),
                         data_host_config.ssh_connection)
Esempio n. 2
0
    def create_with(database_credentials, host_controller):
        data_retriever_config = RSRDataRetrieverConfig(DataHostPaths())
        host_file_system = FileSystem(host_controller)
        settings_reader = DjangoSettingsReader.create_with(data_retriever_config.rsr_log_file_path,
                                                           data_retriever_config.rsr_env_path,
                                                           data_retriever_config.rsr_app_path,
                                                           host_controller)

        return RSRDataRetriever(data_retriever_config,
                                host_file_system,
                                LocalFileSystem(),
                                settings_reader,
                                DataHandler(database_credentials, host_controller),
                                host_controller.feedback,
                                TimeStampFormatter())
    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(RSRDataRetrieverTest, self).setUp()
        self.data_retriever_config = RSRDataRetrieverConfig(DataHostPaths())
        self.mock_data_host_file_system = self.mox.CreateMock(FileSystem)
        self.mock_local_file_system = self.mox.CreateMock(LocalFileSystem)
        self.mock_settings_reader = self.mox.CreateMock(DjangoSettingsReader)
        self.mock_data_handler = self.mox.CreateMock(DataHandler)
        self.mock_feedback = self.mox.CreateMock(ExecutionFeedback)
        self.mock_time_stamp_formatter = self.mox.CreateMock(
            TimeStampFormatter)

        self.data_retriever = RSRDataRetriever(
            self.data_retriever_config, self.mock_data_host_file_system,
            self.mock_local_file_system, self.mock_settings_reader,
            self.mock_data_handler, self.mock_feedback,
            self.mock_time_stamp_formatter)
Esempio n. 5
0
 def __init__(self):
     self.ssh_connection = SSHConnection.for_host(HostAlias.DATA)
     self.host_paths = DataHostPaths()
Esempio n. 6
0
    def setUp(self):
        super(RSRDataRetrieverConfigTest, self).setUp()
        self.data_host_paths = DataHostPaths()

        self.data_retriever_config = RSRDataRetrieverConfig(
            self.data_host_paths)
    def test_has_logging_home(self):
        """fab.tests.config.values.data_host_paths_test  Has logging home"""

        self.assertEqual(HostPathValues.LIVE['logging_home'], DataHostPaths().logging_home)
    def test_has_deployment_processing_home(self):
        """fab.tests.config.values.data_host_paths_test  Has deployment processing home"""

        self.assertEqual(HostPathValues.LIVE['deployment_processing_home'], DataHostPaths().deployment_processing_home)
    def test_has_virtualenvs_home(self):
        """fab.tests.config.values.data_host_paths_test  Has virtualenvs home"""

        self.assertEqual(HostPathValues.LIVE['virtualenvs_home'], DataHostPaths().virtualenvs_home)
Esempio n. 10
0
    def test_has_django_apps_home(self):
        """fab.tests.config.values.data_host_paths_test  Has Django apps home"""

        self.assertEqual(HostPathValues.LIVE['repo_checkout_home'], DataHostPaths().django_apps_home)
Esempio n. 11
0
    def test_has_config_home(self):
        """fab.tests.config.values.data_host_paths_test  Has configuration home"""

        self.assertEqual(HostPathValues.LIVE['config_home'], DataHostPaths().config_home)
    def test_can_create_remote_credentials_file_reader_instance_for_data_host(
            self):
        """fab.tests.config.rsr.credentials.credentials_file_reader_test  Can create a RemoteCredentialsFileReader instance for a data host"""

        RemoteCredentialsFileReader.create_with(DataHostPaths())
    def test_can_create_instance_for_remote_data_host(self):
        """fab.tests.config.rsr.credentials.credentials_file_reader_test  Can create CredentialsFileReader instance for a remote data host"""

        self._verify_instance_creation_for(DataHostPaths(),
                                           RemoteHostController)