Exemple #1
0
 def testCreateProperty(self):
     '''
     Basic operations of creating, listing and deleting a Logbook object
     '''
     client = OlogClient(url='https://localhost:8181/Olog', username='******', password='******')
     testAttributes = {"attr":"test"}
     testProperty = Property(name='testProperty32', attributes=testAttributes)
     client.createProperty(testProperty)
     self.assertTrue(testProperty in client.listProperties(), 'failed to create the testProperty')
     '''Delete Property only deletes attributes in the service - will be fixed in the service'''
     client.delete(propertyName='testProperty32')
     self.assertTrue(testProperty not in client.listProperties(), 'failed to cleanup the testProperty')
Exemple #2
0
 def CreateProperty(self):
     '''
     Basic operations of creating, listing and deleting a property object
     TODO: the cleanup needs to be resolved
     '''
     client = OlogClient(url=getDefaultTestConfig('url'), username=getDefaultTestConfig('username'), password=getDefaultTestConfig('password'))
     testAttributes = {"attr":"test"}
     testProperty = Property(name='testProperty31', attributes=testAttributes)
     client.createProperty(testProperty)
     self.assertTrue(testProperty in client.listProperties(), 'failed to create the testProperty')
     '''Delete Property only deletes attributes in the service - will be fixed in the service'''
     client.delete(propertyName='testProperty31')
     self.assertTrue(testProperty not in client.listProperties(), 'failed to cleanup the testProperty')
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')