github: fix test
[idea/community.git] / plugins / github / test / org / jetbrains / plugins / github / GithubShareProjectTestBase.java
index ea07ca1eaf1d686bb597da377d0fbeadcbbc81fe..7b76930cca4998223fe0133a67856b46774df1d5 100644 (file)
@@ -17,6 +17,7 @@ package org.jetbrains.plugins.github;
 
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.util.Clock;
+import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.text.DateFormatUtil;
 import git4idea.GitUtil;
 import git4idea.repo.GitRepository;
@@ -27,6 +28,7 @@ import org.jetbrains.plugins.github.test.GithubTest;
 import org.jetbrains.plugins.github.ui.GithubShareDialog;
 
 import java.io.IOException;
+import java.util.Collections;
 import java.util.Random;
 
 /**
@@ -75,4 +77,19 @@ public abstract class GithubShareProjectTestBase extends GithubTest {
                                             }
                                           });
   }
+
+  protected void registerSelectNoneUntrackedFilesDialogHandler() {
+    myDialogManager.registerDialogHandler(GithubShareAction.GithubUntrackedFilesDialog.class,
+                                          new TestDialogHandler<GithubShareAction.GithubUntrackedFilesDialog>() {
+                                            @Override
+                                            public int handleDialog(GithubShareAction.GithubUntrackedFilesDialog dialog) {
+                                              // actually we should ask user for name/email ourselves (like in CommitDialog)
+                                              for (GitRepository repository : GitUtil.getRepositoryManager(myProject).getRepositories()) {
+                                                setGitIdentity(repository.getRoot());
+                                              }
+                                              dialog.setSelectedFiles(Collections.<VirtualFile>emptyList());
+                                              return DialogWrapper.OK_EXIT_CODE;
+                                            }
+                                          });
+  }
 }