Browse code
conversation returns user name
Greg Wiley authored on 13/04/2017 18:17:49
Showing 3 changed files
Showing 3 changed files
... | ... |
@@ -12,10 +12,11 @@ class token_conversation { |
12 | 12 |
virtual std::string user_name() { return ""; } |
13 | 13 |
}; |
14 | 14 |
|
15 |
-class pam_token_conversation : token_conversation { |
|
15 |
+class pam_token_conversation : public token_conversation { |
|
16 | 16 |
public: |
17 | 17 |
pam_token_conversation(pam_handle_t *pamh); |
18 | 18 |
std::string token(); |
19 |
+ std::string user_name(); |
|
19 | 20 |
}; |
20 | 21 |
|
21 | 22 |
#endif |
... | ... |
@@ -16,6 +16,18 @@ int returns_correct_token() { |
16 | 16 |
succeed(); |
17 | 17 |
} |
18 | 18 |
|
19 |
+int returns_correct_user_name() { |
|
20 |
+ //given |
|
21 |
+ pam_handle_t *pamh; |
|
22 |
+ |
|
23 |
+ //when |
|
24 |
+ pam_token_conversation conversation(pamh); |
|
25 |
+ |
|
26 |
+ //then |
|
27 |
+ check(conversation.user_name() == "user", "returned incorrect user name"); |
|
28 |
+ succeed(); |
|
29 |
+} |
|
30 |
+ |
|
19 | 31 |
|
20 | 32 |
|
21 | 33 |
RESET_VARS_START |
... | ... |
@@ -23,6 +35,7 @@ RESET_VARS_END |
23 | 35 |
|
24 | 36 |
int run_tests() { |
25 | 37 |
test(returns_correct_token); |
38 |
+ test(returns_correct_user_name); |
|
26 | 39 |
succeed(); |
27 | 40 |
} |
28 | 41 |
|