def test_delete_fails(self): """ Test that failing to delete a project raises """ self.req_delete.status_code = 400 self.req.content = self.project_content self.gerrit_con.call.side_effect = [self.req, self.req_delete] project = Project(self.gerrit_con) project = project.get_project(self.PROJECT) with self.assertRaises(UnhandledError): project.delete()
def test_delete_success_options(self): """ Test that it is possible to delete a project with options """ self.req.content = self.project_content self.gerrit_con.call.side_effect = [self.req, self.req_delete] project = Project(self.gerrit_con) project = project.get_project(self.PROJECT) self.assertTrue(project.delete({'force': True})) self.gerrit_con.call.assert_called_with( request='delete', r_endpoint='/a/projects/{}'.format(self.PROJECT), r_headers={}, r_payload={'force': True}, )