mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Add a test for cloning disabled projects
This commit is contained in:
parent
20a748f14e
commit
5e08f6f5c6
2 changed files with 39 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
]
|
Loading…
Reference in a new issue