def test_load_config_uses_default_path(self, mock_yaml_load):
        env_without_config_path = {}
        self.app = TestApp(wsgi_api.get_webapp(), extra_environ=env_without_config_path)

        wsgi_api.get_config()

        mock_yaml_load.assert_called_with('/etc/afp-resource-maker')
 def setUp(self):
     self.patcher = patch('afp_resource_maker.RoleMaker._boto_connect')
     self.mock_boto_connect = self.patcher.start()
     self.mock_boto_connection = Mock()
     self.mock_boto_connect.return_value = self.mock_boto_connection
     # https://github.com/gabrielfalcao/HTTPretty/issues/122
     self.restore_proxy = os.environ.get('http_proxy')
     if self.restore_proxy is not None:
         del os.environ['http_proxy']
     self.config_path = tempfile.mkdtemp(prefix='afp-resource-maker-tests-')
     auth_config = {
         'access_key_id': 'AKIAIOSFODNN7EXAMPLE',
         'secret_access_key': 'aJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY'
     }
     role_config = {
         'role': {
             'prefix': 'foobar_',
             'trust_policy_document': '',
             'policy_name': 'test_policy_name',
             'policy_document': ''
         },
     }
     self.writeyaml(auth_config, os.path.join(self.config_path, 'auth.yaml'))
     self.writeyaml(role_config, os.path.join(self.config_path, 'role.yaml'))
     environment = dict(CONFIG_PATH=self.config_path)
     self.app = TestApp(wsgi_api.get_webapp(), extra_environ=environment)
    def test_status_bad_case_with_missing_config(self):
        missing_config = os.path.join(self.config_path, "missing_config.yaml")
        env_with_wrong_config_path = {'CONFIG_PATH': missing_config}
        self.app = TestApp(wsgi_api.get_webapp(), extra_environ=env_with_wrong_config_path)

        result = self.app.get('/status', expect_errors=True)

        self.assertEqual(result.status_int, 500)