Exemple #1
0
 def testCreateTag(self):
     '''
     Basic operations of creating, listing and deleting a Tag object
     '''
     client = OlogClient(url=getDefaultTestConfig('url'), username=getDefaultTestConfig('username'), password=getDefaultTestConfig('password'))
     testTag = Tag(name='testTag', state="Active")
     client.createTag(testTag)
     self.assertTrue(testTag in client.listTags(), 'failed to create the testTag')
     client.delete(tagName='testTag')
     self.assertTrue(testTag not in client.listTags(), 'failed to cleanup the testTag')
Exemple #2
0
 def testCreateTag(self):
     '''
     Basic operations of creating, listing and deleting a Tag object
     '''
     client = OlogClient(url='https://localhost:8181/Olog', username='******', password='******')
     testTag = Tag(name='testTag', state="Active")
     client.createTag(testTag)
     self.assertTrue(testTag in client.listTags(), 'failed to create the testTag')
     client.delete(tagName='testTag')
     self.assertTrue(testTag not in client.listTags(), 'failed to cleanup the testTag')
Exemple #3
0
    def testCreateEntryWithMultipleAttributes(self):
        client = OlogClient(url=getDefaultTestConfig('url'), username=getDefaultTestConfig('username'), password=getDefaultTestConfig('password'))
        text = 'test python log entry with multiple attributes ' + datetime.now().isoformat(' ')
        testImageAttachment = Attachment(open('Desert.jpg', 'rb'))
        testTextAttachment = Attachment(open('debug.log', 'rb'))
        logbooks = client.listLogbooks()
        tags = client.listTags()
        properties = client.listProperties()    
#        for property in properties:
#            for attribute in property.getAttributeNames():
#                property.Attributes[attribute] = 'testValue'+attribute
        testLog = LogEntry(text=text,
                           owner='testOwner',
                           logbooks=logbooks,
                           tags=tags,
#                           properties=properties,
                           attachments=[testImageAttachment, testTextAttachment]
                           )
        client.log(testLog)
        logEntries = client.find(search=text)
        self.assertEqual(len(logEntries), 1, 'Failed to create log entry with multiple attributes')
        logEntry = logEntries[0]
        self.assertListEqual(logbooks, logEntry.getLogbooks(), 'Failed to create log entry with all the logbooks')
        self.assertListEqual(tags, logEntry.getTags(), 'Failed to create log entry with all the tags')
#        self.assertListEqual(properties, logEntry.getProperties(), 'Failed to create log Entry with all the properties')
        client.delete(logEntryId=logEntry.getId()) 
        self.assertEqual(len(client.find(search=text)), 0, 'Failed to cleanup log entry with attachment')      
Exemple #4
0
 def testCreateEntryWithTag(self):
     client = OlogClient(url=getDefaultTestConfig('url'), username=getDefaultTestConfig('username'), password=getDefaultTestConfig('password'))
     testLogbook = Logbook(name='testLogbook', owner='testOwner')
     client.createLogbook(testLogbook);
     testTag = Tag(name='testTag')
     client.createTag(testTag)        
     text = 'test python log entry with tag ' + datetime.now().isoformat(' ')
     testLog = LogEntry(text=text,
                        owner='testOwner',
                        logbooks=[testLogbook],
                        tags=[testTag])
     client.log(testLog)
     logEntries = client.find(search=testLog.getText())
     self.assertTrue(len(logEntries) == 1, 'Failed to create log Entry with Tag')
     self.assertTrue(testTag in logEntries[0].getTags(), 'testTag not attached to the testLogEntry1')
     '''cleanup'''
     client.delete(logEntryId=logEntries[0].getId())
     self.assertTrue(len(client.find(search=testLog.getText())) == 0, 'Failed to delete log Entry with Tag')
     client.delete(logbookName=testLogbook.getName())
     self.assertTrue(testLogbook not in client.listLogbooks(), 'failed to cleanup the testLogbook')
     client.delete(tagName=testTag.getName())
     self.assertTrue(testTag not in client.listTags(), 'failed to cleanup the testTag')
     pass