def test_buildDescription(): gh = GitHub(token='foo') task1 = Task() task1.title = "Test 1" task1.description = "This is a description 1" task2 = Task() task2.title = "Test 2" task2.description = "This is a description 2" tasks = [task1, task2] desc = "This is a sample feature description" result = gh._buildDescription(desc, tasks) assert result == "This is a sample feature description" \ "\n" \ "\n- [ ] **Test 1**" \ "\n This is a description 1" \ "\n" \ "\n- [ ] **Test 2**" \ "\n This is a description 2"
def test_deploy_withRepo(fs): MockedFiles._mockCorrectFileSystem(fs) def mock_returnNone(*args, **kwargs): return None gh = GitHub(token='foo') gh._createOrgRepo = MagicMock(return_value=mock_returnNone) gh._createUserRepo = MagicMock(return_value=mock_returnNone) gh._deleteLabels = MagicMock(return_value=mock_returnNone) gh._createProject = MagicMock(return_value=mock_returnNone) gh._createColumns = MagicMock(return_value=mock_returnNone) gh._createMilestone = MagicMock(return_value=mock_returnNone) gh._createIssue = MagicMock(return_value=mock_returnNone) gh._createCard = MagicMock(return_value=mock_returnNone) gh._buildDescription = MagicMock(return_value=mock_returnNone) backlog = Backlog() config = backlog._getConfig('workitems/correct') workItems = backlog._buildWorkItems(MockedFiles._mockParsedFileList(), config) args = argparse.Namespace() args.org = None args.repo = 'testUser' args.project = 'testProject' args.backlog = 'correct' gh.deploy(args, workItems) gh._createUserRepo.assert_called_with('testProject') gh._deleteLabels.assert_called() assert gh._createProject.call_count == 4 assert gh._createColumns.call_count == 4 assert gh._createMilestone.call_count == 6 assert gh._createIssue.call_count == 4 assert gh._createCard.call_count == 4