|
5 | 5 | import java.util.Map; |
6 | 6 |
|
7 | 7 | import org.junit.jupiter.api.BeforeEach; |
8 | | -import org.junit.jupiter.api.DisplayName; |
9 | 8 | import org.junit.jupiter.api.Test; |
10 | | -import org.springframework.expression.spel.SpelEvaluationException; |
11 | 9 |
|
12 | 10 | import io.github.isagroup.services.jwt.PricingJwtUtils; |
13 | 11 |
|
@@ -132,46 +130,4 @@ void tokenUserContextTest() { |
132 | 130 | "UserContext havePetsDashboard value is not the same after token codification"); |
133 | 131 |
|
134 | 132 | } |
135 | | - |
136 | | - private class NoExpressionsInFeatures extends PricingContext { |
137 | | - |
138 | | - @Override |
139 | | - public String getConfigFilePath() { |
140 | | - return "pricing/feature-inoperative-no-expression.yaml"; |
141 | | - } |
142 | | - |
143 | | - @Override |
144 | | - public String getJwtSecret() { |
145 | | - return "Testing"; |
146 | | - } |
147 | | - |
148 | | - @Override |
149 | | - public Map<String, Object> getUserContext() { |
150 | | - Map<String, Object> map = new HashMap<>(); |
151 | | - map.put("pets", 1); |
152 | | - return map; |
153 | | - } |
154 | | - |
155 | | - @Override |
156 | | - public String getUserPlan() { |
157 | | - return "BASIC"; |
158 | | - } |
159 | | - |
160 | | - } |
161 | | - |
162 | | - @Test |
163 | | - @DisplayName("Given a feature with no 'expression' should be disabled in the pricing token") |
164 | | - void givenAFeatureWithNoExpressionShouldNotThrowWhenComputingUserToken() { |
165 | | - |
166 | | - PricingContext context = new NoExpressionsInFeatures(); |
167 | | - PricingEvaluatorUtil pricingEvaluatorUtil = new PricingEvaluatorUtil(context); |
168 | | - PricingJwtUtils pricingJwtUtils = new PricingJwtUtils(context); |
169 | | - assertDoesNotThrow(() -> pricingEvaluatorUtil.generateUserToken()); |
170 | | - |
171 | | - Map<String, Map<String, Object>> featureStatuses = pricingJwtUtils |
172 | | - .getFeaturesFromJwtToken(pricingEvaluatorUtil.generateUserToken()); |
173 | | - assertFalse((boolean) featureStatuses.get("support").get("eval")); |
174 | | - |
175 | | - } |
176 | | - |
177 | 133 | } |
0 commit comments