git.fiddlerwoaroof.com
Browse code

addtion happy log

Greg Wiley authored on 26/04/2017 17:54:21
Showing 2 changed files
... ...
@@ -24,9 +24,9 @@ namespace {
24 24
               const std::string &token) {
25 25
                 std::string message(user_name + " " + token + " success");
26 26
 
27
-                syslog_.openlog("", 0, LOG_AUTHPRIV);
27
+                syslog_.openlog("dual-control", 0, LOG_AUTHPRIV);
28 28
                 syslog_.syslog(LOG_NOTICE, message.c_str());
29
-                syslog_.closelog();
29
+               syslog_.closelog();
30 30
             }
31 31
     };
32 32
 }
... ...
@@ -23,15 +23,22 @@ class mock_syslog : public sys_syslog_ifc {
23 23
         int facility;
24 24
         std::string message;
25 25
         int priority;
26
+        bool closed;
27
+        std::string ident;
28
+        mock_syslog() : closed(false), facility(-1000), priority(-1000) {}
26 29
         void openlog(const char *ident, int logopt, int facility) {
27 30
             this->facility = facility;
31
+            this->ident = ident;
28 32
         }
29 33
         void vsyslog(int priority, const char *message, va_list args) {
30 34
             this->priority = priority;
31 35
             this->message = message;
32 36
         }
33 37
         void closelog()
34
-        {}
38
+        {
39
+            this->closed = true;
40
+        }
41
+
35 42
 
36 43
 };
37 44
 
... ...
@@ -52,6 +59,8 @@ int logs_success() {
52 59
     check(capture->facility == LOG_AUTHPRIV, "facility does not match");
53 60
     check(capture->message == user + " " + token + " " + "success", "message does not match");
54 61
     check(capture->priority == LOG_NOTICE, "priority does not match");
62
+    check(capture->closed, "syslog not closed");
63
+    check(capture->ident == "dual-control", "dual-control");
55 64
     succeed();
56 65
 }
57 66