Add a test for cloning disabled projects

This commit is contained in:
Michael Walker 2018-02-05 15:32:01 +00:00
parent 20a748f14e
commit 5e08f6f5c6
2 changed files with 39 additions and 0 deletions

View file

@ -45,6 +45,9 @@ public class WLGitBridgeIntegrationTest {
put("cannotCloneAProtectedProject", new HashMap<String, SnapshotAPIState>() {{
put("state", new SnapshotAPIStateBuilder(getResourceAsStream("/cannotCloneAProtectedProject/state/state.json")).build());
}});
put("cannotCloneADisabledProject", new HashMap<String, SnapshotAPIState>() {{
put("state", new SnapshotAPIStateBuilder(getResourceAsStream("/cannotCloneADisabledProject/state/state.json")).build());
}});
put("canPullAModifiedTexFile", new HashMap<String, SnapshotAPIState>() {{
put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedTexFile/base/state.json")).build());
put("withModifiedTexFile", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedTexFile/withModifiedTexFile/state.json")).build());
@ -727,6 +730,24 @@ public class WLGitBridgeIntegrationTest {
wlgb.stop();
}
@Test
public void cannotCloneADisabledProject() throws IOException, GitAPIException, InterruptedException {
int gitBridgePort = 33879;
int mockServerPort = 3879;
MockSnapshotServer server = new MockSnapshotServer(mockServerPort, getResource("/cannotCloneADisabledProject").toFile());
server.start();
server.setState(states.get("cannotCloneADisabledProject").get("state"));
GitBridgeApp wlgb = new GitBridgeApp(new String[] {
makeConfigFile(gitBridgePort, mockServerPort)
});
wlgb.run();
Process gitProcess = runtime.exec("git clone http://127.0.0.1:" + gitBridgePort + "/testproj.git", null, dir);
wlgb.stop();
assertNotEquals(0, gitProcess.waitFor());
}
private String makeConfigFile(
int port,
int apiPort

View file

@ -0,0 +1,18 @@
[
{
"project": "disabled",
"getDoc": {
"error": 410,
"versionID": 1,
"createdAt": "2018-02-05T15:30:00Z",
"email": "michael.walker@overleaf.com",
"name": "msw"
},
"getSavedVers": [],
"getForVers": [],
"push": "success",
"postback": {
"type": "outOfDate"
}
}
]