Skip to content

Commit e00f005

Browse files
Thomasludomikula
Thomas
authored andcommitted
Create addApp/moveApp test case
1 parent edc9b8d commit e00f005

File tree

2 files changed

+52
-10
lines changed

2 files changed

+52
-10
lines changed

server/api-service/lowcoder-server/src/test/java/org/lowcoder/api/bundle/BundleApiServiceImplTest.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,46 @@ public void createBundleTest() {
9393
.expectError()
9494
.verify();
9595
}
96+
97+
@Test
98+
public void moveAddAppTest() {
99+
when(sessionUserService.getVisitorId()).thenReturn(Mono.just("user01"));
100+
when(sessionUserService.getVisitorOrgMemberCache()).thenReturn(Mono.just(new OrgMember("org01", "user01", MemberRole.ADMIN, "NORMAL", 0)));
101+
//Create bundles
102+
Mono<BundleInfoView> bundleInfoViewMono = bundleApiService.create(new BundleEndpoints.CreateBundleRequest(
103+
"org01",
104+
"name",
105+
"title",
106+
"description",
107+
"category",
108+
"image",
109+
null));
110+
BundleInfoView bundleInfoView2 = bundleApiService.create(new BundleEndpoints.CreateBundleRequest(
111+
"org01",
112+
"name2",
113+
"title",
114+
"description",
115+
"category",
116+
"image",
117+
null)).block();
118+
assert bundleInfoView2 != null;
119+
120+
StepVerifier.create(bundleInfoViewMono)
121+
.assertNext(bundleInfoView -> {
122+
//And then add app01 to created bundle
123+
StepVerifier.create(bundleApiService.addApp("app01", bundleInfoView.getBundleId()))
124+
.verifyComplete();
125+
//or move bundle
126+
StepVerifier.create(bundleApiService.moveApp("app01", bundleInfoView.getBundleId(), bundleInfoView2.getBundleId()))
127+
.verifyComplete();
128+
//Try no dev user to add app to bundle
129+
when(sessionUserService.getVisitorId()).thenReturn(Mono.just("user01"));
130+
when(sessionUserService.getVisitorOrgMemberCache()).thenReturn(Mono.just(new OrgMember("org01", "user01", MemberRole.MEMBER, "NORMAL", 0)));
131+
StepVerifier.create(bundleApiService.addApp("app01", bundleInfoView.getBundleId()))
132+
.expectError();
133+
StepVerifier.create(bundleApiService.moveApp("app01", bundleInfoView.getBundleId(), bundleInfoView2.getBundleId()))
134+
.expectError();
135+
})
136+
.verifyComplete();
137+
}
96138
}

server/api-service/lowcoder-server/src/test/java/org/lowcoder/api/common/json/application.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,70 +4,70 @@
44
{
55
"id": "app01",
66
"name": "app01",
7-
"orgId": "org01",
7+
"organizationId": "org01",
88
"applicationType": 1,
99
"applicationStatus": "NORMAL"
1010
},
1111
{
1212
"id": "app02",
1313
"name": "app02",
14-
"orgId": "org01",
14+
"organizationId": "org01",
1515
"applicationType": 1,
1616
"applicationStatus": "NORMAL"
1717
},
1818
{
1919
"id": "app03",
2020
"name": "app03",
21-
"orgId": "org01",
21+
"organizationId": "org01",
2222
"applicationType": 1,
2323
"applicationStatus": "RECYCLED"
2424
},
2525
{
2626
"id": "app04",
2727
"name": "app04",
28-
"orgId": "org01",
28+
"organizationId": "org01",
2929
"applicationType": 1,
3030
"applicationStatus": "DELETED"
3131
},
3232
{
3333
"id": "app05",
3434
"name": "app05",
35-
"orgId": "org01",
35+
"organizationId": "org01",
3636
"applicationType": 1,
3737
"applicationStatus": "NORMAL"
3838
},
3939
{
4040
"id": "app06",
4141
"name": "app06",
42-
"orgId": "org01",
42+
"organizationId": "org01",
4343
"applicationType": 1,
4444
"applicationStatus": "NORMAL"
4545
},
4646
{
4747
"id": "app07",
4848
"name": "app07",
49-
"orgId": "org01",
49+
"organizationId": "org01",
5050
"applicationType": 1,
5151
"applicationStatus": "NORMAL"
5252
},
5353
{
5454
"id": "app08",
5555
"name": "app08",
56-
"orgId": "org01",
56+
"organizationId": "org01",
5757
"applicationType": 1,
5858
"applicationStatus": "NORMAL"
5959
},
6060
{
6161
"id": "app09",
6262
"name": "app09",
63-
"orgId": "org01",
63+
"organizationId": "org01",
6464
"applicationType": 1,
6565
"applicationStatus": "NORMAL"
6666
},
6767
{
6868
"id": "app10",
6969
"name": "app10",
70-
"orgId": "org01",
70+
"organizationId": "org01",
7171
"applicationType": 1,
7272
"applicationStatus": "NORMAL"
7373
}

0 commit comments

Comments
 (0)