def ExportIssues(github_owner_username, github_repo_name, github_oauth_token,
                 issue_file_path, project_name, user_file_path, rate_limit,
                 rewrite_comments):
  """Exports all issues for a given project."""
  github_service = github_services.GitHubService(
      github_owner_username, github_repo_name, github_oauth_token,
      rate_limit)
  issue_service = github_services.IssueService(github_service)
  user_service = github_services.UserService(github_service)

  issue_data = issues.LoadIssueData(issue_file_path, project_name)
  user_map = issues.LoadUserData(user_file_path, user_service)

  # Add a special "user_requesting_export" user, which comes in handy.
  user_map["user_requesting_export"] = github_owner_username

  issue_exporter = issues.IssueExporter(
      issue_service, user_service, issue_data, project_name, user_map)

  try:
    issue_exporter.Init(rewrite_comments)
    issue_exporter.Start(rewrite_comments)
    print "\nDone!\n"
  except IOError, e:
    print "[IOError] ERROR: %s" % e
 def setUp(self):
     self.http_mock = github_services.Http2Mock()
     self.github_service = github_services.GitHubService(
         GITHUB_USERNAME,
         GITHUB_REPO,
         GITHUB_TOKEN,
         rate_limit=False,
         http_instance=self.http_mock)