Skip to content
This repository has been archived by the owner on May 3, 2020. It is now read-only.

Commit

Permalink
tests: port of manage command test
Browse files Browse the repository at this point in the history
* Moves tests authored by many different people from invenio package.

Co-authored-by: Dimitrios Semitsoglou-Tsiapos <dsemitso@cern.ch>
Co-authored-by: Sami Hiltunen <sami.mikael.hiltunen@cern.ch>
Co-authored-by: Tibor Simko <tibor.simko@cern.ch>
Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
  • Loading branch information
4 people committed Sep 18, 2015
1 parent 70e269f commit 1d9a715
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions tests/test_manage.py
@@ -0,0 +1,50 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013, 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

"""Unit tests for the inveniomanage script."""

from __future__ import print_function

import sys

from invenio_base.utils import run_py_func
from invenio.testsuite import InvenioTestCase


class UpgraderManageTest(InvenioTestCase):

def test_upgrade_show_applied_cmd(self):
""" Test `upgrade show applied` command. """
from invenio_upgrader.manage import main
out = run_py_func(main, 'upgrader show applied').out

expected = '>>> Following upgrade(s) have been applied:'
self.assertTrue(expected in out.split('\n'),
"%s was not found in output %s" % (expected, out))

def test_upgrade_show_pending_cmd(self):
""" Test `upgrade show pending` command. """
from invenio_upgrader.manage import main
out = run_py_func(main, 'upgrader show pending').out

lines = out.split('\n')
expected = ('>>> Following upgrade(s) are ready to be applied:',
'>>> All upgrades have been applied.')
self.assertTrue(expected[0] in lines or expected[1] in lines,
"%s was not found in output %s" % (expected, lines))

0 comments on commit 1d9a715

Please sign in to comment.