Blob Blame Raw
From c60282de39f4553e5854cb7347c3c5719ec07242 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenko@redhat.com>
Date: Thu, 9 Mar 2017 11:00:48 +0100
Subject: [PATCH 4/5] tests: remove builddep test

Now we would need to mock Sack, it's much easier to replace test with
function test.

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>

Closes: #204
Approved by: jmracek

(cherry picked from commit b45538445f0c457bfa8d512676e7b13612d33d05)
---
 tests/test_builddep.py | 71 --------------------------------------------------
 1 file changed, 71 deletions(-)
 delete mode 100644 tests/test_builddep.py

diff --git a/tests/test_builddep.py b/tests/test_builddep.py
deleted file mode 100644
index ba2e547..0000000
--- a/tests/test_builddep.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright (C) 2014  Red Hat, Inc.
-#
-# This copyrighted material is made available to anyone wishing to use,
-# modify, copy, or redistribute it subject to the terms and conditions of
-# the GNU General Public License v.2, or (at your option) any later version.
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY expressed or implied, including the implied warranties 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 this program; if not, write to the
-# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
-# source code or documentation are not subject to the GNU General Public
-# License and may only be used or replicated with the express permission of
-# Red Hat, Inc.
-#
-
-from __future__ import absolute_import
-from __future__ import unicode_literals
-from tests.support import mock
-
-import builddep
-import dnf
-import os
-import tests.support as support
-import unittest
-
-SOURCE = os.path.join(os.path.dirname(__file__), 'resources/tour-4-6.src.rpm')
-SPEC = os.path.join(os.path.dirname(__file__), 'resources/tour.spec')
-
-class MockBase(object):
-    def __init__(self):
-        self.marked = []
-        self.repos = dnf.repodict.RepoDict()
-
-    def install(self, spec):
-        self.marked.append(spec)
-
-class BuildDepCommandTest(unittest.TestCase):
-
-    def setUp(self):
-        self.cmd = builddep.BuildDepCommand(support.CliStub(None))
-
-    def test_source(self):
-        with mock.patch('builddep.BuildDepCommand.base', MockBase()) as base:
-            self.cmd.configure((SOURCE,))
-            self.cmd.run((SOURCE,))
-            self.assertEqual(base.marked,
-                             ['emacs-extras', 'emacs-goodies >= 100'])
-
-    @unittest.skipIf(support.PY3, "rpm.spec not available in Py3")
-    def test_spec(self):
-        with mock.patch('builddep.BuildDepCommand.base', MockBase()) as base:
-            self.cmd.configure((SPEC,))
-            self.cmd.run((SPEC,))
-            self.assertEqual(base.marked,
-                             ['emacs-extras', 'emacs-goodies >= 100'])
-
-    @unittest.skipIf(support.PY3, "rpm.spec not available in Py3")
-    def test_macro(self):
-        with mock.patch('builddep.BuildDepCommand.base', MockBase()) as base:
-            self.cmd.configure(('--define', 'enable_optional_module 1', SPEC,))
-            self.cmd.run(('--define', 'enable_optional_module 1', SPEC,))
-            self.assertEqual(base.marked,
-                             ['emacs-extras', 'emacs-goodies >= 100',
-                              'emacs-module'])
-
-    def test_configure(self):
-        with mock.patch('builddep.BuildDepCommand.base', MockBase()) as base:
-            self.cmd.configure(['tour'])
-            self.assertTrue(self.cmd.cli.demands.available_repos)
-- 
2.12.1