use of org.jetbrains.plugins.github.api.requests.GithubGistRequest.FileContent in project intellij-community by JetBrains.
the class GithubCreateGistContentTest method testCreateFromEditorWithoutFile.
public void testCreateFromEditorWithoutFile() throws Throwable {
VirtualFile file = myProjectRoot.findFileByRelativePath("file.txt");
assertNotNull(file);
Document document = FileDocumentManager.getInstance().getDocument(file);
assertNotNull(document);
myEditor = EditorFactory.getInstance().createEditor(document, myProject);
assertNotNull(myEditor);
List<FileContent> expected = new ArrayList<>();
expected.add(new FileContent("", "file.txt content"));
List<FileContent> actual = GithubCreateGistAction.collectContents(myProject, myEditor, null, null);
checkEquals(expected, actual);
}
use of org.jetbrains.plugins.github.api.requests.GithubGistRequest.FileContent in project intellij-community by JetBrains.
the class GithubCreateGistContentTest method testCreateFromFiles.
public void testCreateFromFiles() throws Throwable {
List<FileContent> expected = new ArrayList<>();
expected.add(new FileContent("file.txt", "file.txt content"));
expected.add(new FileContent("file2", "file2 content"));
expected.add(new FileContent("file3", "file3 content"));
VirtualFile[] files = new VirtualFile[3];
files[0] = myProjectRoot.findFileByRelativePath("file.txt");
files[1] = myProjectRoot.findFileByRelativePath("folder/file2");
files[2] = myProjectRoot.findFileByRelativePath("folder/dir/file3");
assertNotNull(files[0]);
assertNotNull(files[1]);
assertNotNull(files[2]);
List<FileContent> actual = GithubCreateGistAction.collectContents(myProject, null, null, files);
checkEquals(expected, actual);
}
use of org.jetbrains.plugins.github.api.requests.GithubGistRequest.FileContent in project intellij-community by JetBrains.
the class GithubCreateGistContentTest method testCreateFromFile.
public void testCreateFromFile() throws Throwable {
List<FileContent> expected = new ArrayList<>();
expected.add(new FileContent("file.txt", "file.txt content"));
VirtualFile file = myProjectRoot.findFileByRelativePath("file.txt");
assertNotNull(file);
List<FileContent> actual = GithubCreateGistAction.collectContents(myProject, null, file, null);
checkEquals(expected, actual);
}
use of org.jetbrains.plugins.github.api.requests.GithubGistRequest.FileContent in project intellij-community by JetBrains.
the class GithubCreateGistContentTest method testCreateFromEditor.
public void testCreateFromEditor() throws Throwable {
VirtualFile file = myProjectRoot.findFileByRelativePath("file.txt");
assertNotNull(file);
Document document = FileDocumentManager.getInstance().getDocument(file);
assertNotNull(document);
myEditor = EditorFactory.getInstance().createEditor(document, myProject);
assertNotNull(myEditor);
List<FileContent> expected = new ArrayList<>();
expected.add(new FileContent("file.txt", "file.txt content"));
List<FileContent> actual = GithubCreateGistAction.collectContents(myProject, myEditor, file, null);
checkEquals(expected, actual);
}
use of org.jetbrains.plugins.github.api.requests.GithubGistRequest.FileContent in project intellij-community by JetBrains.
the class GithubCreateGistTest method testUsedFilenameField.
public void testUsedFilenameField() throws Throwable {
List<FileContent> content = Collections.singletonList(new FileContent("file.txt", "file.txt content"));
List<FileContent> expected = Collections.singletonList(new FileContent("filename", "file.txt content"));
String url = GithubCreateGistAction.createGist(myProject, getAuthDataHolder(), myIndicator, content, true, GIST_DESCRIPTION, "filename");
assertNotNull(url);
GIST_ID = url.substring(url.lastIndexOf('/') + 1);
checkGistExists();
checkGistNotAnonymous();
checkGistPrivate();
checkGistDescription(GIST_DESCRIPTION);
checkGistContent(expected);
}
Aggregations