diff options
author | Akash Keshav <112591754+domesticchores@users.noreply.github.com> | 2025-03-18 17:10:14 -0400 |
---|---|---|
committer | Akash Keshav <112591754+domesticchores@users.noreply.github.com> | 2025-03-18 17:10:14 -0400 |
commit | 28339dd8694a91c9f7d08bc5155fe6765440428a (patch) | |
tree | 2ac44e862a46a87475deb865a2cc37f9e81d3670 /ufund-api | |
parent | 0268894e5b80c908d2c3eb5c2228ee22fde52904 (diff) | |
parent | 9044bbbff92618990fa4a4bd82cfcc96781da526 (diff) | |
download | JellySolutions-28339dd8694a91c9f7d08bc5155fe6765440428a.tar.gz JellySolutions-28339dd8694a91c9f7d08bc5155fe6765440428a.tar.bz2 JellySolutions-28339dd8694a91c9f7d08bc5155fe6765440428a.zip |
Merge branch 'funding_basket' of https://github.com/RIT-SWEN-261-02/team-project-2245-swen-261-02-2b-jellysolutions into funding_basket
Diffstat (limited to 'ufund-api')
3 files changed, 9 insertions, 9 deletions
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/UserController.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/UserController.java index a16fdec..fd6a960 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/UserController.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/UserController.java @@ -104,7 +104,7 @@ public class UserController { public ResponseEntity<User> updateUser(@RequestBody User user, @PathVariable String username, @RequestHeader("jelly-api-key") String key) { LOG.log(Level.INFO,"PUT: " + user + " " + username + " " + key.toString()); try { - //authService.authenticate(username, key); + authService.authenticate(username, key); user = userService.updateUser(user, username); if (user != null) { return new ResponseEntity<>(user, HttpStatus.OK); @@ -115,9 +115,9 @@ public class UserController { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } catch (IOException e) { return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); - } //catch (IllegalAccessException e) { - // return new ResponseEntity<>(HttpStatus.UNAUTHORIZED); - // } + } catch (IllegalAccessException e) { + return new ResponseEntity<>(HttpStatus.UNAUTHORIZED); + } } /** diff --git a/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/CupboardControllerTest.java b/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/CupboardControllerTest.java index 94f93cb..6ef6710 100644 --- a/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/CupboardControllerTest.java +++ b/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/CupboardControllerTest.java @@ -39,7 +39,7 @@ public class CupboardControllerTest { Map<String, Object> needMap = Map.ofEntries( entry("name", "Test"), - entry("maxGoal", 100), + entry("maxGoal", 100.0), entry("type", "MONETARY") ); @@ -55,12 +55,12 @@ public class CupboardControllerTest { Map<String, Object> needMap = Map.ofEntries( entry("name", "Name"), - entry("maxGoal", -100), + entry("maxGoal", -100.0), entry("type", "MONETARY")); var res = cupboardController.createNeed(needMap); - assertEquals(HttpStatus.UNPROCESSABLE_ENTITY, res.getStatusCode()); + assertEquals(HttpStatus.BAD_REQUEST, res.getStatusCode()); } @Test @@ -69,7 +69,7 @@ public class CupboardControllerTest { Map<String, Object> needMap = Map.ofEntries( entry("name", "Name"), - entry("maxGoal", 100), + entry("maxGoal", 100.0), entry("type", "MONETARY")); var res = cupboardController.createNeed(needMap); diff --git a/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/UserControllerTest.java b/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/UserControllerTest.java index b6367ad..cc7df40 100644 --- a/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/UserControllerTest.java +++ b/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/UserControllerTest.java @@ -1,7 +1,6 @@ package com.ufund.api.ufundapi.controller; import java.io.IOException; -import java.security.InvalidParameterException; import java.util.Map; import static java.util.Map.entry; @@ -239,6 +238,7 @@ public class UserControllerTest { // When updateUser is called on the Mock User service, throw a Invalid Parameter exception // exception doThrow(new IllegalAccessException()).when(mockAuthService).authenticate(username, key); + // Invoke ResponseEntity<User> response = userController.updateUser(user, username, key); |