Browse code
find user handles mismatching username
Greg Wiley authored on 21/04/2017 23:29:11
Showing 1 changed files
Showing 1 changed files
... | ... |
@@ -56,7 +56,20 @@ int find_user_happy() { |
56 | 56 |
//then |
57 | 57 |
check(!results.empty(), "user should have been found"); |
58 | 58 |
succeed(); |
59 |
+} |
|
60 |
+ |
|
61 |
+int user_not_found() { |
|
62 |
+ //given |
|
63 |
+ pwd test_pwd(pwd::delegate(new fake_pwd("user"))); |
|
64 |
+ unistd test_unistd(unistd::delegate(new fake_unistd(_SC_GETPW_R_SIZE_MAX))); |
|
65 |
+ directory directory(directory::create(test_unistd, test_pwd)); |
|
59 | 66 |
|
67 |
+ //when |
|
68 |
+ std::vector<user> results = directory.find_user("not_user"); |
|
69 |
+ |
|
70 |
+ //then |
|
71 |
+ check(results.empty(), "user should not have been found"); |
|
72 |
+ succeed(); |
|
60 | 73 |
|
61 | 74 |
} |
62 | 75 |
|