# Path: ddsc/sdk/dukeds.py
# class DukeDS(object):
# class Session(object):
#     def list_projects():
#     def create_project(name, description):
#     def delete_project(project_name):
#     def is_project_consistent(project_name):
#     def wait_for_project_consistency(project_name, wait_sec=5):
#     def create_folder(project_name, remote_path):
#     def list_files(project_name):
#     def download_file(project_name, remote_path, local_path=None):
#     def move_file_or_folder(project_name, source_remote_path, target_remote_path):
#     def upload_file(project_name, local_path, remote_path=None):
#     def delete_file(project_name, remote_path):
#     def can_deliver_to_user_with_email(email_address, logging_func=logging.info):
#     def can_deliver_to_user_with_username(username, logging_func=logging.info):
#     def __init__(self, config=None):
#     def list_projects(self):
#     def create_project(self, name, description):
#     def delete_project(self, project_name):
#     def create_folder(self, project_name, remote_path):
#     def list_files(self, project_name):
#     def download_file(self, project_name, remote_path, local_path=None):
#     def upload_file(self, project_name, local_path, remote_path=None):
#     def _get_or_create_project(self, project_name):
#     def _cache_project_list_once(self):
#     def clear_project_cache(self):
#     def _get_project_for_name(self, project_name):
#     def _get_file_path_dict_for_project(project):
#     def delete_file(self, project_name, remote_path):
#     def can_deliver_to_user_with_email(self, email_address, logging_func):
#     def can_deliver_to_user_with_username(self, username, logging_func):
#     def move_file_or_folder(self, project_name, source_remote_path, target_remote_path):
#     def is_project_consistent(self, project_name):
#     def wait_for_project_consistency(self, project_name, wait_sec=5):


from unittest import TestCase
from ddsc import DukeDS, ItemNotFound, DuplicateNameError, Session
from mock import patch, Mock, ANY
        mock_client.return_value.get_projects.return_value = [
            self.bat_dna_project,
            self.mouse_rna_project
        ]

        projects = DukeDS.list_projects()

        self.assertEqual(projects, ['bat_dna', 'mouse_rna'])

    @patch('ddsc.sdk.dukeds.Client')
    def test_create_project(self, mock_client):
        DukeDS.create_project('mouse', 'Mouse research project')

        mock_client.return_value.create_project.assert_called_with('mouse', 'Mouse research project')

    @patch('ddsc.sdk.dukeds.Client')
    def test_create_project_raises_for_duplicate_project_name(self, mock_client):
        mock_existing_project = Mock()
        mock_existing_project.name = 'mouse'
        mock_client.return_value.get_projects.return_value = [mock_existing_project]

        with self.assertRaises(DuplicateNameError):
            DukeDS.create_project('mouse', 'Mouse research project')

    @patch('ddsc.sdk.dukeds.Client')
    def test_delete_project_not_found(self, mock_client):
        mock_client.return_value.get_projects.return_value = [
            self.bat_dna_project
        ]
        with self.assertRaises(ItemNotFound):

# Path: ddsc/sdk/dukeds.py
# class DukeDS(object):
# class Session(object):
#     def list_projects():
#     def create_project(name, description):
#     def delete_project(project_name):
#     def is_project_consistent(project_name):
#     def wait_for_project_consistency(project_name, wait_sec=5):
#     def create_folder(project_name, remote_path):
#     def list_files(project_name):
#     def download_file(project_name, remote_path, local_path=None):
#     def move_file_or_folder(project_name, source_remote_path, target_remote_path):
#     def upload_file(project_name, local_path, remote_path=None):
#     def delete_file(project_name, remote_path):
#     def can_deliver_to_user_with_email(email_address, logging_func=logging.info):
#     def can_deliver_to_user_with_username(username, logging_func=logging.info):
#     def __init__(self, config=None):
#     def list_projects(self):
#     def create_project(self, name, description):
#     def delete_project(self, project_name):
#     def create_folder(self, project_name, remote_path):
#     def list_files(self, project_name):
#     def download_file(self, project_name, remote_path, local_path=None):
#     def upload_file(self, project_name, local_path, remote_path=None):
#     def _get_or_create_project(self, project_name):
#     def _cache_project_list_once(self):
#     def clear_project_cache(self):
#     def _get_project_for_name(self, project_name):
#     def _get_file_path_dict_for_project(project):
#     def delete_file(self, project_name, remote_path):
#     def can_deliver_to_user_with_email(self, email_address, logging_func):
#     def can_deliver_to_user_with_username(self, username, logging_func):
#     def move_file_or_folder(self, project_name, source_remote_path, target_remote_path):
#     def is_project_consistent(self, project_name):
#     def wait_for_project_consistency(self, project_name, wait_sec=5):


# Path: ddsc/sdk/tests/test_dukeds.py
from unittest import TestCase
from ddsc import DukeDS, ItemNotFound, DuplicateNameError, Session
from mock import patch, Mock, ANY

        mock_client.return_value.get_projects.return_value = [
            self.bat_dna_project,
            self.mouse_rna_project
        ]

        projects = DukeDS.list_projects()

        self.assertEqual(projects, ['bat_dna', 'mouse_rna'])

    @patch('ddsc.sdk.dukeds.Client')
    def test_create_project(self, mock_client):
        DukeDS.create_project('mouse', 'Mouse research project')

        mock_client.return_value.create_project.assert_called_with('mouse', 'Mouse research project')

    @patch('ddsc.sdk.dukeds.Client')
    def test_create_project_raises_for_duplicate_project_name(self, mock_client):
        mock_existing_project = Mock()
        mock_existing_project.name = 'mouse'
        mock_client.return_value.get_projects.return_value = [mock_existing_project]

        with self.assertRaises(DuplicateNameError):
            DukeDS.create_project('mouse', 'Mouse research project')

    @patch('ddsc.sdk.dukeds.Client')
    def test_delete_project_not_found(self, mock_client):
        mock_client.return_value.get_projects.return_value = [
            self.bat_dna_project
        ]
        with self.assertRaises(ItemNotFound):

            DukeDS.delete_project('mouse_rna')