mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
canPullADeletedBinaryFile integration test.
This commit is contained in:
parent
5e8e042ad2
commit
f0f5333161
8 changed files with 145 additions and 0 deletions
|
@ -47,6 +47,10 @@ public class WLGitBridgeIntegrationTest {
|
||||||
put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedBinaryFile/base/state.json")).build());
|
put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedBinaryFile/base/state.json")).build());
|
||||||
put("withModifiedBinaryFile", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedBinaryFile/withModifiedBinaryFile/state.json")).build());
|
put("withModifiedBinaryFile", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedBinaryFile/withModifiedBinaryFile/state.json")).build());
|
||||||
}});
|
}});
|
||||||
|
put("canPullADeletedBinaryFile", new HashMap<String, SnapshotAPIState>() {{
|
||||||
|
put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullADeletedBinaryFile/base/state.json")).build());
|
||||||
|
put("withDeletedBinaryFile", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullADeletedBinaryFile/withDeletedBinaryFile/state.json")).build());
|
||||||
|
}});
|
||||||
put("cannotCloneAProtectedProject", new HashMap<String, SnapshotAPIState>() {{
|
put("cannotCloneAProtectedProject", new HashMap<String, SnapshotAPIState>() {{
|
||||||
put("state", new SnapshotAPIStateBuilder(getResourceAsStream("/cannotCloneAProtectedProject/state/state.json")).build());
|
put("state", new SnapshotAPIStateBuilder(getResourceAsStream("/cannotCloneAProtectedProject/state/state.json")).build());
|
||||||
}});
|
}});
|
||||||
|
@ -165,6 +169,29 @@ public class WLGitBridgeIntegrationTest {
|
||||||
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canPullAModifiedBinaryFile/withModifiedBinaryFile/testproj"), testprojDir.toPath()));
|
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canPullAModifiedBinaryFile/withModifiedBinaryFile/testproj"), testprojDir.toPath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void canPullADeletedBinaryFile() throws IOException, GitAPIException, InterruptedException {
|
||||||
|
MockSnapshotServer server = new MockSnapshotServer(3863, getResource("/canPullADeletedBinaryFile").toFile());
|
||||||
|
server.start();
|
||||||
|
server.setState(states.get("canPullADeletedBinaryFile").get("base"));
|
||||||
|
GitBridgeApp wlgb = new GitBridgeApp(new String[] {
|
||||||
|
makeConfigFile(33863, 3863)
|
||||||
|
});
|
||||||
|
wlgb.run();
|
||||||
|
File dir = folder.newFolder();
|
||||||
|
Process gitBase = runtime.exec("git clone http://127.0.0.1:33863/testproj.git", null, dir);
|
||||||
|
int exitCodeBase = gitBase.waitFor();
|
||||||
|
File testprojDir = new File(dir, "testproj");
|
||||||
|
assertEquals(0, exitCodeBase);
|
||||||
|
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canPullADeletedBinaryFile/base/testproj"), testprojDir.toPath()));
|
||||||
|
server.setState(states.get("canPullADeletedBinaryFile").get("withDeletedBinaryFile"));
|
||||||
|
Process gitWithModifiedBinaryFile = runtime.exec("git pull", null, testprojDir);
|
||||||
|
int exitCodeWithModifiedBinaryFile = gitWithModifiedBinaryFile.waitFor();
|
||||||
|
wlgb.stop();
|
||||||
|
assertEquals(0, exitCodeWithModifiedBinaryFile);
|
||||||
|
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canPullADeletedBinaryFile/withDeletedBinaryFile/testproj"), testprojDir.toPath()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static final String EXPECTED_OUT_PROTECTED =
|
private static final String EXPECTED_OUT_PROTECTED =
|
||||||
"Cloning into 'protected'...\n" +
|
"Cloning into 'protected'...\n" +
|
||||||
|
|
|
@ -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:3863/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,68 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"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": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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:3863/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 @@
|
||||||
|
This text is from another file.
|
Loading…
Reference in a new issue