def test_delete_policy_converts_returned_data_to_expected_objects( self, mock_http_client): api = Api(url='http://localhost', login_id='mylogin', api_key='apikey') def mock_auth(): return 'apitoken' api.authenticate = mock_auth output = api.delete_policy_file('mypolicyname', self.POLICY_FILE) self.assertEqual(output, MOCK_POLICY_CHANGE_OBJECT)
def test_delete_policy_invokes_http_client_correctly( self, mock_http_client): api = Api(url='http://localhost', login_id='mylogin', api_key='apikey') def mock_auth(): return 'apitoken' api.authenticate = mock_auth api.delete_policy_file('mypolicyname', self.POLICY_FILE) policy_data = None with open(self.POLICY_FILE, 'r') as content_file: policy_data = content_file.read() self.verify_http_call(mock_http_client, HttpVerb.PATCH, ConjurEndpoint.POLICIES, policy_data, identifier='mypolicyname', ssl_verify=True)