Browse code
do not pass if unkknown requester
Greg Wiley authored on 02/05/2017 17:45:34
Showing 2 changed files
Showing 2 changed files
... | ... |
@@ -132,6 +132,25 @@ bool validator_fails_with_own_token() { |
132 | 132 |
|
133 | 133 |
} |
134 | 134 |
|
135 |
+bool validator_fails_with_unknown_requester() { |
|
136 |
+ // given |
|
137 |
+ std::string requester_user_name(""); |
|
138 |
+ std::string authorizer_user_name("authorizer"); |
|
139 |
+ std::string authorizer_token("token"); |
|
140 |
+ directory directory (share (new fake_directory (authorizer_user_name))); |
|
141 |
+ user_token_supplier user_token_supplier (share (new |
|
142 |
+ fake_user_token_supplier(authorizer_token))); |
|
143 |
+ validator validator = validator::create (directory, user_token_supplier); |
|
144 |
+ |
|
145 |
+ // when |
|
146 |
+ bool actual = validator.validate (requester_user_name, authorizer_user_name, authorizer_token); |
|
147 |
+ |
|
148 |
+ // then |
|
149 |
+ check(!actual, "should not be valid"); |
|
150 |
+ succeed(); |
|
151 |
+ |
|
152 |
+} |
|
153 |
+ |
|
135 | 154 |
RESET_VARS_START |
136 | 155 |
RESET_VARS_END |
137 | 156 |
|
... | ... |
@@ -141,6 +160,7 @@ bool run_tests() |
141 | 160 |
test (validator_fails_unknown_user); |
142 | 161 |
test (validator_fails_incorrect_token); |
143 | 162 |
test (validator_fails_with_own_token); |
163 |
+ test (validator_fails_with_unknown_requester); |
|
144 | 164 |
succeed(); |
145 | 165 |
} |
146 | 166 |
|