Пример #1
0
    def test_mongo(self):
        bucket_name = 'test_bucket_mongo'
        bucket = Bucket()
        bucket.bucket_name = bucket_name
        bucket.save()

        key = 'my_test_key'
        value = 'my test value'
        name = "my name"
        description = 'something meaningful here'
        tags = ['testing', 'development']

        isSaved = bucket.setValue(key, value, name, description, tags=tags)
        obj = bucket._getData(key)

        self.assertIsNotNone(obj)
        self.assertEqual(obj.key, key)
        self.assertEqual(obj.name, name)
        self.assertEqual(obj.value, value)
        self.assertEqual(obj.description, description)
        self.assertEqual(obj.data_type, '')

        self.assertTrue(bucket.hasKey(key))
        for tag in tags:
            self.assertTrue(bucket.hasTag(tag))
            self.assertTrue(bucket.hasTagKey(tag, key))
    def test_mongo(self):
        bucket_name = 'test_bucket_mongo'
        bucket = Bucket()
        bucket.bucket_name = bucket_name
        bucket.save()

        key = 'my_test_key'
        value = 'my test value'
        name = "my name"
        description = 'something meaningful here'
        tags = ['testing', 'development']

        isSaved = bucket.setValue(key, value, name, description, tags=tags)
        obj = bucket._getData(key)

        self.assertIsNotNone(obj)
        self.assertEqual(obj.key, key)
        self.assertEqual(obj.name, name)
        self.assertEqual(obj.value, value)
        self.assertEqual(obj.description, description)
        self.assertEqual(obj.data_type, '')
        
        self.assertTrue(bucket.hasKey(key))
        for tag in tags:
            self.assertTrue(bucket.hasTag(tag))
            self.assertTrue(bucket.hasTagKey(tag, key))
Пример #3
0
 def simpleTest(self):
     self.populate()
     x = Bucket.objects(bucket_name="ONR").first()
     print "*" * 20
     print Bucket.objects()
     print x.getBucketName()
     print "*" * 20
     testKey = "AAAAAAAAA"
     testVal = 10
     x.adaptor_map[testKey] = testVal
     x.aSave()
     print x.adaptor_map.keys()
     y = Bucket.objects(bucket_name="ONR").first()
     print "Added"
     print x.adaptor_map.keys()
     print y.adaptor_map.keys()
     del y.adaptor_map[testKey]
     y.aSave()
     print "Deleted"
     z = Bucket.objects(bucket_name="ONR").first()
     print x.adaptor_map.keys()
     print y.adaptor_map.keys()
     print z.adaptor_map.keys()
Пример #4
0
    def test_create_bucket(self):
        bucket_name = 'test_bucket_create'
        bucket = Bucket.make(bucket_name)
        storageService = MongoStorageService()
        bucket.bucket_name = bucket_name
        bucket.save()

        bucket = None
        bucket = storageService.getBucket(bucket_name)
        self.assertIsNotNone(bucket)
        self.assertEqual(bucket.bucket_name, bucket_name)
        self.assertEqual(bucket.tag_maps, {})
        self.assertEqual(bucket.name_map, {})
        self.assertEqual(bucket.adaptor_map, {})
 def simpleTest(self):
     self.populate()
     x = Bucket.objects(bucket_name="ONR").first()
     print "*"*20
     print Bucket.objects()
     print x.getBucketName()
     print "*"*20
     testKey = "AAAAAAAAA"
     testVal = 10
     x.adaptor_map[testKey] = testVal
     x.aSave()
     print x.adaptor_map.keys()
     y = Bucket.objects(bucket_name="ONR").first()
     print "Added"
     print x.adaptor_map.keys()
     print y.adaptor_map.keys()
     del y.adaptor_map[testKey]
     y.aSave()
     print "Deleted"
     z = Bucket.objects(bucket_name="ONR").first()
     print x.adaptor_map.keys()
     print y.adaptor_map.keys()
     print z.adaptor_map.keys()
    def test_create_bucket(self):
        bucket_name = 'test_bucket_create'
        bucket = Bucket.make(bucket_name)
        storageService = MongoStorageService()
        bucket.bucket_name = bucket_name
        bucket.save()

        bucket = None
        bucket = storageService.getBucket(bucket_name)
        self.assertIsNotNone(bucket)
        self.assertEqual(bucket.bucket_name, bucket_name)
        self.assertEqual(bucket.tag_maps, {})
        self.assertEqual(bucket.name_map, {})
        self.assertEqual(bucket.adaptor_map, {})