Skip to content

Commit

Permalink
Test: UnivCertApiTest 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
pjhcsols committed Oct 6, 2024
1 parent 4905d09 commit 95d923d
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 38 deletions.
44 changes: 16 additions & 28 deletions web3-credential-server/build/reports/tests/test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h1>Test Summary</h1>
</td>
<td>
<div class="infoBox" id="failures">
<div class="counter">1</div>
<div class="counter">0</div>
<p>failures</p>
</div>
</td>
Expand All @@ -38,7 +38,7 @@ <h1>Test Summary</h1>
</td>
<td>
<div class="infoBox" id="duration">
<div class="counter">0.003s</div>
<div class="counter">0.478s</div>
<p>duration</p>
</div>
</td>
Expand All @@ -47,8 +47,8 @@ <h1>Test Summary</h1>
</div>
</td>
<td>
<div class="infoBox failures" id="successRate">
<div class="percent">0%</div>
<div class="infoBox success" id="successRate">
<div class="percent">100%</div>
<p>successful</p>
</div>
</td>
Expand All @@ -58,25 +58,13 @@ <h1>Test Summary</h1>
<div id="tabs">
<ul class="tabLinks">
<li>
<a href="#tab0">Failed tests</a>
</li>
<li>
<a href="#tab1">Packages</a>
<a href="#tab0">Packages</a>
</li>
<li>
<a href="#tab2">Classes</a>
<a href="#tab1">Classes</a>
</li>
</ul>
<div id="tab0" class="tab">
<h2>Failed tests</h2>
<ul class="linkList">
<li>
<a href="classes/web3.api.univCert.UnivCertApiTest.html">UnivCertApiTest</a>.
<a href="classes/web3.api.univCert.UnivCertApiTest.html#shouldSendCertificationCodeSuccessfully()">인증 코드 전송에 성공해야 합니다.</a>
</li>
</ul>
</div>
<div id="tab1" class="tab">
<h2>Packages</h2>
<table>
<thead>
Expand All @@ -91,19 +79,19 @@ <h2>Packages</h2>
</thead>
<tbody>
<tr>
<td class="failures">
<td class="success">
<a href="packages/web3.api.univCert.html">web3.api.univCert</a>
</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0.003s</td>
<td class="failures">0%</td>
<td>0</td>
<td>0.478s</td>
<td class="success">100%</td>
</tr>
</tbody>
</table>
</div>
<div id="tab2" class="tab">
<div id="tab1" class="tab">
<h2>Classes</h2>
<table>
<thead>
Expand All @@ -118,14 +106,14 @@ <h2>Classes</h2>
</thead>
<tbody>
<tr>
<td class="failures">
<td class="success">
<a href="classes/web3.api.univCert.UnivCertApiTest.html">web3.api.univCert.UnivCertApiTest</a>
</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0.003s</td>
<td class="failures">0%</td>
<td>0</td>
<td>0.478s</td>
<td class="success">100%</td>
</tr>
</tbody>
</table>
Expand All @@ -138,7 +126,7 @@ <h2>Classes</h2>
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
</label>
</div>Generated by
<a href="http://www.gradle.org">Gradle 8.4</a> at 2024. 10. 6. 오후 8:24:04</p>
<a href="http://www.gradle.org">Gradle 8.4</a> at 2024. 10. 6. 오후 9:08:24</p>
</div>
</div>
</body>
Expand Down
Binary file modified web3-credential-server/build/test-results/test/binary/output.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class UnivCertApiTest {
void shouldSendCertificationCodeSuccessfully() {
// JSON Request Payload
String jsonRequest = "{\n" +
" \"key\": \"0572d205-ba30-4260-beb7-87577c91e30a\",\n" +
" \"key\": \"43086994-92b9-4caa-8b3e-be2510051c8e\",\n" +
" \"email\": \"[email protected]\",\n" +
" \"univName\": \"경북대학교\",\n" +
" \"univ_check\": true\n" +
Expand Down Expand Up @@ -150,4 +150,37 @@ void shouldClearCertifiedUserListSuccessfully() {
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(response.getBody()).contains("\"success\":true");
}

@Test
@DisplayName("인증 요청할 대학명 전송에 성공해야 합니다.")
void shouldSendUnivNameSuccessfully() {
// JSON Request Payload
String jsonRequest = """
{
"univName" : "경북대학교"
}
""";

// Set Headers
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);

// Create HttpEntity
HttpEntity<String> request = new HttpEntity<>(jsonRequest, headers);

// Send POST request to the /check endpoint
ResponseEntity<String> response = restTemplate.exchange(
"https://univcert.com/api/v1/check",
HttpMethod.POST,
request,
String.class
);

// 로그에 응답 본문 출력
System.out.println("Response Body: " + response.getBody());

// Validate Response for success
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(response.getBody()).contains("\"success\":true");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ spring.jpa.hibernate.ddl-auto=create
spring.h2.console.enabled=true
spring.main.allow-bean-definition-overriding=true


# AWS S3 Service bucket
#cloud.aws.s3-bucket-name= deep
# AWS S3 Bucket URL
#cloud.aws.s3-bucket-url= deep
#cloud.aws.credentials-accessKey= deep
#cloud.aws.credentials-secretKey= deep

# AWS S3 Service Configuration
cloud.aws.s3BucketName=deep
cloud.aws.s3BucketUrl=deep
Expand All @@ -27,4 +19,4 @@ jwt.refresh-token-validity=86400000

# Kakao Configuration
kakao.client-id=deep
kakao.redirect-uri=http://localhost:8080
kakao.redirect-uri=http://localhost:8080

0 comments on commit 95d923d

Please sign in to comment.