def test_create_card(mock_Github): gh = GitHub(token='foo') gh.github = mock_Github repo = gh._get_user().create_repo() project = gh._create_project(repo, 'testOrg', 'testBody') column = gh._create_column(project, 'test') issue = gh._create_issue(repo, 'testMilestone', 'testTitle', 'testBody', []) gh._create_card(column, issue) column.create_card.assert_called_with(content_id=issue.id, content_type="Issue")
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