Example #1
0
    def test_call_error_posts_to_callback_url(self):
        log = ["a", "b", "c"]
        e = Exception
        callback.call_error(self.fixture, callback, e, log)

        postdata = {"applied_hash": callback.hash_deployment_config(self.fixture),
                    "error": e,
                    "module": callback.__name__,
                    "log": "\n".join(log)}

        self.mock_post.assert_called_once_with(self.fixture["callback_url"],
                                               data=postdata,
                                               headers={'User-Agent': 'nodeconfig/callback for appname1'},
                                               verify=True)
Example #2
0
 def test_call_error_raises_exception_if_post_fails(self):
     self.mock_response.status_code = 404
     with self.assertRaises(callback.CallbackException):
         callback.call_error(self.fixture, callback, Exception(), [])
Example #3
0
 def test_call_error_hashes_nodeconfig_to_create_hash(self):
     mock_hash = self.setUpPatch('hypernode.nodeconfig.callback.hash_deployment_config')
     callback.call_error(self.fixture, callback, Exception(), [])
     mock_hash.assert_called_with(self.fixture)
Example #4
0
 def test_call_error_checks_callback_url_var(self):
     callback.call_error(self.fixture, callback, Exception(), [])
     self.mock_checkvars.assert_called_once_with(self.fixture, ["callback_url", "app_name"])