def test_get_repo_branch(self, mock_subproc_popen): process_mock = mock.Mock() attrs = {'communicate.return_value': ( "projectRequirements.txt", '')} process_mock.configure_mock(**attrs) mock_subproc_popen.return_value = process_mock x = get_repo_branch("projectRequirements.txt") self.assertTrue(x) self.assertTrue(mock_subproc_popen.called)
def test_get_repo_branch(self, mock_subproc_popen): """ func that test for the repo branch :param mock_subproc_popen: :return: valid if the file exists in the repo branch """ process_mock = mock.Mock() attrs = {'communicate.return_value': ( "projectRequirements.txt", '')} process_mock.configure_mock(**attrs) mock_subproc_popen.return_value = process_mock value = get_repo_branch("projectRequirements.txt") self.assertTrue(value) self.assertTrue(mock_subproc_popen.called)