def test_should_not_include_files_outside_config_directory(self):

        mock_svn_service = Mock(SvnService)
        mock_svn_service.config_url = 'svn://url/for/configuration/repository'
        mock_svn_service.path_to_config = '/config'
        mock_svn_service.client = Mock()
        mock_info = Mock()

        mock_path_object_1 = Mock()
        mock_path_object_1.path = '/config/foo'
        mock_path_object_1.action = 'A'

        mock_path_object_2 = Mock()
        mock_path_object_2.path = '/XXXXXX/bar'
        mock_path_object_2.action = 'A'

        mock_path_object_3 = Mock()
        mock_path_object_3.path = '/XXX/foobar'
        mock_path_object_3.action = 'A'

        mock_info.changed_paths = [mock_path_object_1, mock_path_object_2, mock_path_object_3]
        mock_svn_service.get_logs_for_revision.return_value = [mock_info]

        actual = SvnService.get_changed_paths_with_action(mock_svn_service, '1980')

        self.assertEqual([('foo', 'A')], actual)
Ejemplo n.º 2
0
    def test_should_return_list_with_tuples_including_one_tuple_which_has_a_delete_action(
            self):

        mock_svn_service = Mock(SvnService)
        mock_svn_service.config_url = 'svn://url/for/configuration/repository'
        mock_svn_service.path_to_config = '/config'
        mock_svn_service.client = Mock()
        mock_info = Mock()
        mock_path_object_1 = Mock()
        mock_path_object_1.path = '/config/'
        mock_path_object_1.action = 'A'
        mock_info.changed_paths = [mock_path_object_1]
        mock_path_object_2 = Mock()
        mock_path_object_2.path = '/config/spam.egg'
        mock_path_object_2.action = 'A'
        mock_path_object_3 = Mock()
        mock_path_object_3.path = '/config/foo.bar'
        mock_path_object_3.action = 'D'
        mock_info.changed_paths = [
            mock_path_object_1, mock_path_object_2, mock_path_object_3
        ]
        mock_svn_service.get_logs_for_revision.return_value = [mock_info]

        actual = SvnService.get_changed_paths_with_action(
            mock_svn_service, '1980')

        self.assertEqual([('', 'A'), ('spam.egg', 'A'), ('foo.bar', 'D')],
                         actual)
    def test_should_return_list_with_empty_string_and_action_string_when_configuration_directory_has_been_created_in_commit(self):

        mock_svn_service = Mock(SvnService)
        mock_svn_service.config_url = 'svn://url/for/configuration/repository'
        mock_svn_service.path_to_config = '/config'
        mock_info = Mock()
        mock_path_object = Mock()
        mock_path_object.path = '/config/'
        mock_path_object.action = 'A'
        mock_info.changed_paths = [mock_path_object]
        mock_svn_service.get_logs_for_revision.return_value = [mock_info]

        actual = SvnService.get_changed_paths_with_action(mock_svn_service, '1980')

        self.assertEqual([('', 'A')], actual)
    def test_should_return_list_with_directory_name_and_action_for_path_to_file_when_a_file_has_been_added(self):

        mock_svn_service = Mock(SvnService)
        mock_svn_service.config_url = 'svn://url/for/configuration/repository'
        mock_svn_service.path_to_config = '/config'
        mock_svn_service.client = Mock()
        mock_info = Mock()
        mock_path_object_1 = Mock()
        mock_path_object_1.path = '/config/'
        mock_path_object_1.action = 'A'
        mock_info.changed_paths = [mock_path_object_1]
        mock_path_object_2 = Mock()
        mock_path_object_2.path = '/config/spam.egg'
        mock_path_object_2.action = 'A'
        mock_info.changed_paths = [mock_path_object_1, mock_path_object_2]
        mock_svn_service.get_logs_for_revision.return_value = [mock_info]

        actual = SvnService.get_changed_paths_with_action(mock_svn_service, '1980')

        self.assertEqual([('', 'A'), ('spam.egg', 'A')], actual)
Ejemplo n.º 5
0
    def test_should_return_list_with_tuples_including_one_tuple_which_has_a_delete_action(self):

        mock_svn_service = Mock(SvnService)
        mock_svn_service.config_url = 'svn://url/for/configuration/repository'
        mock_svn_service.path_to_config = '/config'
        mock_svn_service.client = Mock()
        mock_info = Mock()
        mock_path_object_1 = Mock()
        mock_path_object_1.path = '/config/'
        mock_path_object_1.action = 'A'
        mock_info.changed_paths = [mock_path_object_1]
        mock_path_object_2 = Mock()
        mock_path_object_2.path = '/config/spam.egg'
        mock_path_object_2.action = 'A'
        mock_path_object_3 = Mock()
        mock_path_object_3.path = '/config/foo.bar'
        mock_path_object_3.action = 'D'
        mock_info.changed_paths = [mock_path_object_1, mock_path_object_2, mock_path_object_3]
        mock_svn_service.get_logs_for_revision.return_value = [mock_info]

        actual = SvnService.get_changed_paths_with_action(mock_svn_service, '1980')

        self.assertEqual([('', 'A'), ('spam.egg', 'A'), ('foo.bar', 'D')], actual)