# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Test IAM Policies for correctness.""" import copy import json from unittest import mock from foremast.iam.construct_policy import construct_policy from foremast.utils.templates import get_template BASE_SETTINGS = json.loads( get_template(template_file='configs/pipeline.json.j2')) @mock.patch('foremast.utils.credentials.API_URL', 'http://test.com') @mock.patch('foremast.utils.credentials.requests.get') def test_iam_construct_policy(requests_get): """Check general assemblage.""" settings = copy.deepcopy(BASE_SETTINGS) policy_json = construct_policy(pipeline_settings=settings) # checking empty policy assert policy_json is None settings.update({'services': {'s3': True}}) policy_json = construct_policy(app='unicornforrest', env='stage',
def get_base_settings(): return json.loads(get_template(template_file='configs/pipeline.json.j2'))