From aad48e5f6720d5e24820982f9634f851a6d573d7 Mon Sep 17 00:00:00 2001 From: Jang Jun Young Date: Tue, 25 Jun 2024 23:11:29 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=B3=B5=EB=8D=95=EB=B0=A9=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/acceptance/AdminLandApiTest.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/src/test/java/in/koreatech/koin/admin/acceptance/AdminLandApiTest.java b/src/test/java/in/koreatech/koin/admin/acceptance/AdminLandApiTest.java index 12a5df1ce..a44721dd1 100644 --- a/src/test/java/in/koreatech/koin/admin/acceptance/AdminLandApiTest.java +++ b/src/test/java/in/koreatech/koin/admin/acceptance/AdminLandApiTest.java @@ -21,6 +21,7 @@ import in.koreatech.koin.domain.land.model.Land; import in.koreatech.koin.domain.user.model.User; import in.koreatech.koin.fixture.UserFixture; +import in.koreatech.koin.support.JsonAssertions; import io.restassured.RestAssured; @SuppressWarnings("NonAsciiCharacters") @@ -167,4 +168,68 @@ void deleteLand() { softly.assertThat(deletedLand.isDeleted()).isEqualTo(true); }); } + + @Test + @DisplayName("특정 복덕방 정보를 조회한다.") + void getLand() { + // 복덕방 생성 + Land request = Land.builder() + .internalName("금실타운") + .name("금실타운") + .roomType("원룸") + .latitude("37.555") + .longitude("126.555") + .monthlyFee("100") + .charterFee("1000") + .address("가전리 123") + .description("테스트용 복덕방") + .build(); + + Land savedLand = adminLandRepository.save(request); + Integer landId = savedLand.getId(); + + User adminUser = userFixture.코인_운영자(); + String token = userFixture.getToken(adminUser); + + var response = RestAssured + .given() + .header("Authorization", "Bearer " + token) + .when() + .get("/admin/lands/{id}", landId) + .then() + .statusCode(HttpStatus.OK.value()) + .extract(); + + JsonAssertions.assertThat(response.asPrettyString()) + .isEqualTo(String.format(""" + { + "id": %d, + "name": "금실타운", + "internal_name": "금실타운", + "size": null, + "room_type": "원룸", + "latitude": "37.555", + "longitude": "126.555", + "phone": null, + "image_urls": [], + "address": "가전리 123", + "description": "테스트용 복덕방", + "floor": null, + "deposit": null, + "monthly_fee": "100", + "charter_fee": "1000", + "management_fee": null, + "opt_closet": false, + "opt_tv": false, + "opt_microwave": false, + "opt_gas_range": false, + "opt_induction": false, + "opt_water_purifier": false, + "opt_air_conditioner": false, + "opt_washer": false, + "is_deleted": false + } + """, landId)); + } + }