Browse code
handle empty answer
Greg Wiley authored on 17/04/2017 17:44:38
Showing 1 changed files
Showing 1 changed files
... | ... |
@@ -77,6 +77,20 @@ int returns_empty_user_and_token_when_no_colon() { |
77 | 77 |
succeed(); |
78 | 78 |
} |
79 | 79 |
|
80 |
+int returns_empty_user_and_token_when_empty_answer() { |
|
81 |
+ //given |
|
82 |
+ pam_handle_t *pamh; |
|
83 |
+ pam_p pam = (pam_p)new fake_pam(""); |
|
84 |
+ |
|
85 |
+ //when |
|
86 |
+ pam_token_conversation conversation(pamh, pam); |
|
87 |
+ |
|
88 |
+ //then |
|
89 |
+ check(conversation.user_name() == "", "did not return empty user name"); |
|
90 |
+ check(conversation.token() == "", "did not return empty token"); |
|
91 |
+ succeed(); |
|
92 |
+} |
|
93 |
+ |
|
80 | 94 |
int returns_empty_token_when_colon_end() { |
81 | 95 |
//given |
82 | 96 |
pam_handle_t *pamh; |
... | ... |
@@ -115,6 +129,7 @@ int run_tests() { |
115 | 129 |
test(returns_empty_user_and_token_when_no_colon); |
116 | 130 |
test(returns_empty_token_when_colon_end); |
117 | 131 |
test(returns_empty_user_when_colon_begin); |
132 |
+ test(returns_empty_user_and_token_when_empty_answer); |
|
118 | 133 |
succeed(); |
119 | 134 |
} |
120 | 135 |
|