Beispiel #1
0
    def testWriteNoPerms(self):
        entry = fixture.CreateLogEntry('my-payload')
        entry.logName = 'projects/my-project/logs/my-log'

        self.mock_client_v2.entries.Write.Expect(
            v2.WriteLogEntriesRequest(entries=[entry]),
            exception=http_error.MakeHttpError(403))
        self.RunWithoutPerms('write my-log my-payload')
Beispiel #2
0
 def testWriteLogResourceName(self):
     self._setExpect(fixture.CreateLogEntry('my-payload'))
     self.RunLogging('write projects/my-project/logs/my-log my-payload')
Beispiel #3
0
 def testWriteNestedLogName(self):
     entry = fixture.CreateLogEntry('my-payload')
     entry.logName = 'projects/my-project/logs/my-log%2Fnested'
     self._setExpect(entry)
     self.RunLogging('write my-log/nested my-payload')
Beispiel #4
0
 def testWriteStructuredLog(self):
     self._setExpect(
         fixture.CreateLogEntry('my-payload', payload_type='struct'))
     self.RunLogging('write my-log \'{"message": "my-payload"}\' '
                     '--payload-type=json')
     self.AssertErrContains('Created log entry.')
Beispiel #5
0
 def testWriteSeverity(self):
     self._setExpect(
         fixture.CreateLogEntry('my-payload', severity='critical'))
     self.RunLogging('write my-log my-payload --severity=CRITICAL')
     self.AssertErrContains('Created log entry.')
Beispiel #6
0
 def testWriteWithDefaults(self):
     self._setExpect(fixture.CreateLogEntry('my-payload'))
     self.RunLogging('write my-log my-payload')
     self.AssertErrContains('Created log entry.')