Skip to content

Commit

Permalink
[fix] locker 테스트 오류 수정 (#347)
Browse files Browse the repository at this point in the history
* chore: remove test

* chore: test 잘되게 수정
  • Loading branch information
Gwonwoo-Nam authored Nov 5, 2023
1 parent cf1e4d3 commit 7b968ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 33 deletions.
32 changes: 0 additions & 32 deletions src/main/java/upbrella/be/rent/service/LockerService.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,38 +72,6 @@ public LockerPasswordResponse checkSignature(RentUmbrellaByUserRequest rentUmbre
}
return null;
}

public static void main(String[] args) {

String lockerSecretKey = "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF";

String salt = "abc".toUpperCase();

try {
// SHA-256 해시 생성
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] encodedhash = digest.digest((lockerSecretKey + salt).getBytes(StandardCharsets.UTF_8));

// 바이트 배열을 16진수 문자열로 변환
StringBuilder hexString = new StringBuilder(2 * encodedhash.length);
for (byte b : encodedhash) {
String hex = Integer.toHexString(0xff & b);
if (hex.length() == 1) {
hexString.append('0');
}
hexString.append(hex);
}

String lockerSignature = hexString.toString();


System.out.println(lockerSignature);


} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import upbrella.be.rent.entity.History;
import upbrella.be.rent.service.ConditionReportService;
import upbrella.be.rent.service.ImprovementReportService;
import upbrella.be.rent.service.LockerService;
import upbrella.be.rent.service.RentService;
import upbrella.be.slack.service.SlackAlarmService;
import upbrella.be.store.entity.StoreMeta;
Expand Down Expand Up @@ -56,9 +57,12 @@ public class RentControllerTest extends RestDocsSupport {
@Mock
private SlackAlarmService slackAlarmService;

@Mock
private LockerService lockerService;

@Override
protected Object initController() {
return new RentController(conditionReportService, improvementReportService, rentService, userService, slackAlarmService);
return new RentController(conditionReportService, improvementReportService, rentService, userService, slackAlarmService, lockerService);
}

@Test
Expand Down

0 comments on commit 7b968ca

Please sign in to comment.