def test_create_org_repo(mock_Github): gh = GitHub(token='foo') gh.github = mock_Github org = gh._get_org('testOrg') gh._create_org_repo('testOrg', 'testRepo', 'foobar') org.create_repo.assert_called_with(name='testRepo', description='foobar', has_issues=True, auto_init=True, private=True)
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