Ejemplo n.º 1
0
    def test_pool_privileges(self):
        pool = Pool(self.conn, "pool-name", "profile")
        pool.allow_credentials_to_be_exported_to_pool_environment()
        assert pool.privileges is not None
        assert pool.privileges._exportApiAndStorageCredentialsInEnvironment == True

        json_pool = pool._to_json()
        assert json_pool['privileges'] is not None
        assert json_pool['privileges'][
            'exportApiAndStorageCredentialsInEnvironment'] is True

        # fields that need to be non null for the deserialization to not fail
        json_pool['creationDate'] = datetime.datetime.utcnow().strftime(
            "%Y-%m-%dT%H:%M:%SZ")
        json_pool['uuid'] = str(uuid.uuid4())
        json_pool['state'] = 'Submitted'

        pool_from_json = Pool(self.conn, "pool-name", "profile")
        pool_from_json._update(json_pool)
        assert pool_from_json.privileges is not None
        assert pool_from_json.privileges._exportApiAndStorageCredentialsInEnvironment is True
Ejemplo n.º 2
0
 def test_pool_property_send_to_json_representation(self, property_name,
                                                    expected_value):
     pool = Pool(self.conn, "pool-name", "profile")
     pool._update(default_json_pool)
     pool_json = pool._to_json()
     assert pool_json[property_name] == expected_value
Ejemplo n.º 3
0
 def test_pool_property_update_value(self, property_name, expected_value):
     pool = Pool(self.conn, "pool-name", "profile")
     pool._update(default_json_pool)
     assert getattr(pool, property_name) == expected_value