def test_build_initialize_repo(fs, mock_Github): MockedFiles._mock_correct_file_system(fs) gh = GitHub(token='foo') gh.github = mock_Github repo = gh._get_user().create_repo() gh._initialize_repo(repo, './workitems/correct', [ './workitems/correct/README.md', './workitems/correct/feature_01/attachment.doc' ])
def test_deploy_with_repo(fs): MockedFiles._mock_correct_file_system(fs) def mock_return_None(*args, **kwargs): return None gh = GitHub(token='foo') gh._create_org_repo = MagicMock(return_value=mock_return_None) gh._create_user_repo = MagicMock(return_value=mock_return_None) gh._initialize_repo = MagicMock(return_value=mock_return_None) gh._create_labels = MagicMock(return_value=mock_return_None) gh._delete_labels = MagicMock(return_value=mock_return_None) gh._create_project = MagicMock(return_value=mock_return_None) gh._create_columns = MagicMock(return_value=mock_return_None) gh._create_milestone = MagicMock(return_value=mock_return_None) gh._create_issue = MagicMock(return_value=mock_return_None) gh._create_card = MagicMock(return_value=mock_return_None) gh._build_description = MagicMock(return_value=mock_return_None) backlog = Backlog() config = backlog._get_config('workitems/correct', 'github') config["_repository_path"] = 'workitems/correct' work_items = backlog._build_work_items( MockedFiles._mock_parsed_file_list(), config) args = argparse.Namespace() args.org = None args.repo = 'testUser' args.project = 'testProject' args.backlog = 'correct' gh.deploy(args, work_items, config, []) gh._create_user_repo.assert_called_with('testProject', 'Sample description') gh._delete_labels.assert_called() assert gh._create_project.call_count == 4 assert gh._create_columns.call_count == 4 assert gh._create_milestone.call_count == 6 assert gh._create_issue.call_count == 4 assert gh._create_card.call_count == 4