mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Add test for f385cffd
This commit is contained in:
parent
f2701568f6
commit
34c2d7f613
10 changed files with 154 additions and 1 deletions
|
@ -56,8 +56,12 @@ public class WLGitBridgeIntegrationTest {
|
||||||
put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullADeletedBinaryFile/base/state.json")).build());
|
put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullADeletedBinaryFile/base/state.json")).build());
|
||||||
put("withDeletedBinaryFile", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullADeletedBinaryFile/withDeletedBinaryFile/state.json")).build());
|
put("withDeletedBinaryFile", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullADeletedBinaryFile/withDeletedBinaryFile/state.json")).build());
|
||||||
}});
|
}});
|
||||||
|
put("canPullADuplicateBinaryFile", new HashMap<String, SnapshotAPIState>() {{
|
||||||
|
put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullADuplicateBinaryFile/base/state.json")).build());
|
||||||
|
put("withDuplicateBinaryFile", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullADuplicateBinaryFile/withDuplicateBinaryFile/state.json")).build());
|
||||||
|
}});
|
||||||
put("canPullAModifiedNestedFile", new HashMap<String, SnapshotAPIState>() {{
|
put("canPullAModifiedNestedFile", new HashMap<String, SnapshotAPIState>() {{
|
||||||
put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullADeletedBinaryFile/base/state.json")).build());
|
put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedNestedFile/base/state.json")).build());
|
||||||
put("withModifiedNestedFile", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedNestedFile/withModifiedNestedFile/state.json")).build());
|
put("withModifiedNestedFile", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedNestedFile/withModifiedNestedFile/state.json")).build());
|
||||||
}});
|
}});
|
||||||
put("canPullDeletedNestedFiles", new HashMap<String, SnapshotAPIState>() {{
|
put("canPullDeletedNestedFiles", new HashMap<String, SnapshotAPIState>() {{
|
||||||
|
@ -246,6 +250,29 @@ public class WLGitBridgeIntegrationTest {
|
||||||
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canPullADeletedBinaryFile/withDeletedBinaryFile/testproj"), testprojDir.toPath()));
|
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canPullADeletedBinaryFile/withDeletedBinaryFile/testproj"), testprojDir.toPath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void canPullADuplicateBinaryFile() throws IOException, GitAPIException, InterruptedException {
|
||||||
|
MockSnapshotServer server = new MockSnapshotServer(4001, getResource("/canPullADuplicateBinaryFile").toFile());
|
||||||
|
server.start();
|
||||||
|
server.setState(states.get("canPullADuplicateBinaryFile").get("base"));
|
||||||
|
GitBridgeApp wlgb = new GitBridgeApp(new String[] {
|
||||||
|
makeConfigFile(44001, 4001)
|
||||||
|
});
|
||||||
|
wlgb.run();
|
||||||
|
File dir = folder.newFolder();
|
||||||
|
Process gitBase = runtime.exec("git clone http://127.0.0.1:44001/testproj.git", null, dir);
|
||||||
|
int exitCodeBase = gitBase.waitFor();
|
||||||
|
File testprojDir = new File(dir, "testproj");
|
||||||
|
assertEquals(0, exitCodeBase);
|
||||||
|
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canPullADuplicateBinaryFile/base/testproj"), testprojDir.toPath()));
|
||||||
|
server.setState(states.get("canPullADuplicateBinaryFile").get("withDuplicateBinaryFile"));
|
||||||
|
Process gitWithDeletedBinaryFile = runtime.exec("git pull", null, testprojDir);
|
||||||
|
int exitCodeWithDeletedBinaryFile = gitWithDeletedBinaryFile.waitFor();
|
||||||
|
wlgb.stop();
|
||||||
|
assertEquals(0, exitCodeWithDeletedBinaryFile);
|
||||||
|
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canPullADuplicateBinaryFile/withDuplicateBinaryFile/testproj"), testprojDir.toPath()));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void canPullAModifiedNestedFile() throws IOException, GitAPIException, InterruptedException {
|
public void canPullAModifiedNestedFile() throws IOException, GitAPIException, InterruptedException {
|
||||||
MockSnapshotServer server = new MockSnapshotServer(3864, getResource("/canPullAModifiedNestedFile").toFile());
|
MockSnapshotServer server = new MockSnapshotServer(3864, getResource("/canPullAModifiedNestedFile").toFile());
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"project": "testproj",
|
||||||
|
"getDoc": {
|
||||||
|
"versionID": 1,
|
||||||
|
"createdAt": "2014-11-30T18:40:58.123Z",
|
||||||
|
"email": "jdleesmiller+1@gmail.com",
|
||||||
|
"name": "John+1"
|
||||||
|
},
|
||||||
|
"getSavedVers": [
|
||||||
|
{
|
||||||
|
"versionID": 1,
|
||||||
|
"comment": "added more info on doc GET and error details",
|
||||||
|
"email": "jdleesmiller+1@gmail.com",
|
||||||
|
"name": "John+1",
|
||||||
|
"createdAt": "2014-11-30T18:47:01.456Z"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"getForVers": [
|
||||||
|
{
|
||||||
|
"versionID": 1,
|
||||||
|
"srcs": [
|
||||||
|
{
|
||||||
|
"content": "content\n",
|
||||||
|
"path": "main.tex"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"content": "This text is from another file.",
|
||||||
|
"path": "test.tex"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"atts": [
|
||||||
|
{
|
||||||
|
"url": "http://127.0.0.1:4001/base/testproj/overleaf-white-410.png",
|
||||||
|
"path": "overleaf-white-410.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"push": "success",
|
||||||
|
"postback": {
|
||||||
|
"type": "success",
|
||||||
|
"versionID": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1 @@
|
||||||
|
content
|
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
|
@ -0,0 +1 @@
|
||||||
|
This text is from another file.
|
|
@ -0,0 +1,76 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"project": "testproj",
|
||||||
|
"getDoc": {
|
||||||
|
"versionID": 2,
|
||||||
|
"createdAt": "2014-11-30T18:40:58.123Z",
|
||||||
|
"email": "jdleesmiller+1@gmail.com",
|
||||||
|
"name": "John+1"
|
||||||
|
},
|
||||||
|
"getSavedVers": [
|
||||||
|
{
|
||||||
|
"versionID": 2,
|
||||||
|
"comment": "i deleted the image",
|
||||||
|
"email": "jdleesmiller+1@gmail.com",
|
||||||
|
"name": "John+1",
|
||||||
|
"createdAt": "2014-11-30T18:48:01.123Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"versionID": 1,
|
||||||
|
"comment": "added more info on doc GET and error details",
|
||||||
|
"email": "jdleesmiller+1@gmail.com",
|
||||||
|
"name": "John+1",
|
||||||
|
"createdAt": "2014-11-30T18:47:01.456Z"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"getForVers": [
|
||||||
|
{
|
||||||
|
"versionID": 2,
|
||||||
|
"srcs": [
|
||||||
|
{
|
||||||
|
"content": "content\n",
|
||||||
|
"path": "main.tex"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"content": "This text is from another file.",
|
||||||
|
"path": "test.tex"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"atts": [
|
||||||
|
{
|
||||||
|
"url": "http://127.0.0.1:4001/withDuplicateBinaryFile/testproj/overleaf-white-410.png",
|
||||||
|
"path": "overleaf-white-410.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "http://127.0.0.1:4001/withDuplicateBinaryFile/testproj/overleaf-white-410.png",
|
||||||
|
"path": "overleaf-white-410-copy.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"versionID": 1,
|
||||||
|
"srcs": [
|
||||||
|
{
|
||||||
|
"content": "content\n",
|
||||||
|
"path": "main.tex"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"content": "This text is from another file.",
|
||||||
|
"path": "test.tex"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"atts": [
|
||||||
|
{
|
||||||
|
"url": "http://127.0.0.1:4001/withDuplicateBinaryFile/testproj/overleaf-white-410.png",
|
||||||
|
"path": "overleaf-white-410.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"push": "success",
|
||||||
|
"postback": {
|
||||||
|
"type": "success",
|
||||||
|
"versionID": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1 @@
|
||||||
|
content
|
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
|
@ -0,0 +1 @@
|
||||||
|
This text is from another file.
|
Loading…
Reference in a new issue