mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
canPullDeletedNestedFiles integration test.
This commit is contained in:
parent
1de56ef76b
commit
8f416cfd60
11 changed files with 167 additions and 0 deletions
|
@ -55,6 +55,10 @@ public class WLGitBridgeIntegrationTest {
|
|||
put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullADeletedBinaryFile/base/state.json")).build());
|
||||
put("withModifiedNestedFile", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedNestedFile/withModifiedNestedFile/state.json")).build());
|
||||
}});
|
||||
put("canPullDeletedNestedFiles", new HashMap<String, SnapshotAPIState>() {{
|
||||
put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullDeletedNestedFiles/base/state.json")).build());
|
||||
put("withDeletedNestedFiles", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullDeletedNestedFiles/withDeletedNestedFiles/state.json")).build());
|
||||
}});
|
||||
put("cannotCloneAProtectedProject", new HashMap<String, SnapshotAPIState>() {{
|
||||
put("state", new SnapshotAPIStateBuilder(getResourceAsStream("/cannotCloneAProtectedProject/state/state.json")).build());
|
||||
}});
|
||||
|
@ -219,6 +223,29 @@ public class WLGitBridgeIntegrationTest {
|
|||
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canPullAModifiedNestedFile/withModifiedNestedFile/testproj"), testprojDir.toPath()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canPullDeletedNestedFiles() throws IOException, GitAPIException, InterruptedException {
|
||||
MockSnapshotServer server = new MockSnapshotServer(3865, getResource("/canPullDeletedNestedFiles").toFile());
|
||||
server.start();
|
||||
server.setState(states.get("canPullDeletedNestedFiles").get("base"));
|
||||
GitBridgeApp wlgb = new GitBridgeApp(new String[] {
|
||||
makeConfigFile(33865, 3865)
|
||||
});
|
||||
wlgb.run();
|
||||
File dir = folder.newFolder();
|
||||
Process gitBase = runtime.exec("git clone http://127.0.0.1:33865/testproj.git", null, dir);
|
||||
int exitCodeBase = gitBase.waitFor();
|
||||
File testprojDir = new File(dir, "testproj");
|
||||
assertEquals(0, exitCodeBase);
|
||||
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canPullDeletedNestedFiles/base/testproj"), testprojDir.toPath()));
|
||||
server.setState(states.get("canPullDeletedNestedFiles").get("withDeletedNestedFiles"));
|
||||
Process gitWithDeletedBinaryFile = runtime.exec("git pull", null, testprojDir);
|
||||
int exitCodeWithDeletedBinaryFile = gitWithDeletedBinaryFile.waitFor();
|
||||
wlgb.stop();
|
||||
assertEquals(0, exitCodeWithDeletedBinaryFile);
|
||||
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canPullDeletedNestedFiles/withDeletedNestedFiles/testproj"), testprojDir.toPath()));
|
||||
}
|
||||
|
||||
|
||||
private static final String EXPECTED_OUT_PROTECTED =
|
||||
"Cloning into 'protected'...\n" +
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
[
|
||||
{
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"content": "nest1",
|
||||
"path": "nest1/nest1.tex"
|
||||
},
|
||||
{
|
||||
"content": "nest2",
|
||||
"path": "nest1/nest2/nest2.tex"
|
||||
}
|
||||
],
|
||||
"atts": [
|
||||
{
|
||||
"url": "http://127.0.0.1:3865/base/testproj/overleaf-white-410.png",
|
||||
"path": "overleaf-white-410.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"push": "success",
|
||||
"postback": {
|
||||
"type": "success",
|
||||
"versionID": 2
|
||||
}
|
||||
}
|
||||
]
|
|
@ -0,0 +1 @@
|
|||
content
|
|
@ -0,0 +1 @@
|
|||
nest1
|
|
@ -0,0 +1 @@
|
|||
nest2
|
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
|
@ -0,0 +1 @@
|
|||
This text is from another file.
|
|
@ -0,0 +1,80 @@
|
|||
[
|
||||
{
|
||||
"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 nested stuff",
|
||||
"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:3865/withDeletedNestedFiles/testproj/overleaf-white-410.png",
|
||||
"path": "overleaf-white-410.png"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"versionID": 1,
|
||||
"srcs": [
|
||||
{
|
||||
"content": "content\n",
|
||||
"path": "main.tex"
|
||||
},
|
||||
{
|
||||
"content": "This text is from another file.",
|
||||
"path": "test.tex"
|
||||
},
|
||||
{
|
||||
"content": "nest1",
|
||||
"path": "nest1/nest1.tex"
|
||||
},
|
||||
{
|
||||
"content": "nest2",
|
||||
"path": "nest1/nest2/nest2.tex"
|
||||
}
|
||||
],
|
||||
"atts": [
|
||||
{
|
||||
"url": "http://127.0.0.1:3865/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.
|
Loading…
Reference in a new issue