Exemple #1
0
 def test_bucket_in_pool_from_json(self):
     json_bucket = "bucket-name"
     json_pool = {
         "name": "poolName",
         "shortname": "poolShortname",
         "profile": "profile",
         "instanceCount": 1,
         "runningCoreCount": None,
         "runningInstanceCount": None,
         "resourceBuckets": [json_bucket],
         "creationDate": "2019-11-08T10:54:11Z",
         "uuid": "000",
         "state": "Submitted",
     }
     pool = Pool.from_json(self.conn, json_pool)
     pool._auto_update = False
     assert "bucket-name" == pool.resources[0].uuid
Exemple #2
0
    def test_advance_bucket_in_pool_from_json(self):
        json_bucket = {
            "bucketName": "name",
            "filtering": {
                "prefixFiltering": {
                    "prefix": "prefix1"
                }
            },
            "resourcesTransformation": {
                "stripPrefix": {
                    "prefix": "prefix2"
                }
            },
            "cacheTTLSec": 1000
        }
        json_pool = {
            "name": "poolName",
            "shortname": "poolShortname",
            "profile": "profile",
            "instanceCount": 1,
            "runningCoreCount": None,
            "runningInstanceCount": None,
            "advancedResourceBuckets": [json_bucket],
            "creationDate": "2019-11-08T10:54:11Z",
            "uuid": "000",
            "state": "Submitted",
        }
        pool = Pool.from_json(self.conn, json_pool)
        pool._auto_update = False

        assert "name" == pool.resources[0].uuid
        assert "prefix1" == pool.resources[0]._filtering._filters[
            "prefixFiltering"].prefix
        assert "prefix2" == pool.resources[
            0]._resources_transformation._resource_transformers[
                "stripPrefix"].prefix
        assert 1000 == pool.resources[0]._cache_ttl_sec