# Path: distgen/commands.py
# class DnfPkgManager(YumPkgManager):
#     binary = "dnf"
# 
# class YumPkgManager(AbstractPkgManger):
#     binary = "yum"
# 
#     def _base_command(self, opts):
#         base = self.binary + " -y"
#         if self.is_interactive(opts):
#             base = self.binary
# 
#         docs = True
#         if self.in_container(opts):
#             docs = False
# 
#         if opts and 'docs' in opts:
#             docs = opts['docs']
# 
#         docs_string = ""
#         if not docs:
#             docs_string = " --setopt=tsflags=nodocs"
# 
#         return base + docs_string
# 
#     def action(self, action, pkgs, options):
#         return "{0} {1} {2}".format(
#             self._base_command(options),
#             action,
#             " ".join(pkgs),
#         ).strip()
# 
#     def install(self, pkgs, options=None):
#         return self.action("install", pkgs, options)
# 
#     def reinstall(self, pkgs, options=None):
#         return self.action("reinstall", pkgs, options)
# 
#     def remove(self, pkgs, options=None):
#         return self.action("remove", pkgs, options)
# 
#     def update(self, pkgs, options=None):
#         return self.action("update", pkgs, options)
# 
#     def update_all(self, options=None):
#         return self.action("update", [], options)
# 
#     def cleancache(self, options=None):
#         return self._base_command(options) + " clean all --enablerepo='*'"


import pytest
from distgen.commands import DnfPkgManager, YumPkgManager


class TestIndividualPkgManagers(object):
    def setup_method(self, method):
        class Config(object):
            def __init__(self, interactive, container=None):
                self.interactive = interactive
                self.container = container

        self.mgrs = {'yumi': YumPkgManager(Config(True)),
                     'yumni': YumPkgManager(Config(False)),

# Path: distgen/commands.py
# class DnfPkgManager(YumPkgManager):
#     binary = "dnf"
# 
# class YumPkgManager(AbstractPkgManger):
#     binary = "yum"
# 
#     def _base_command(self, opts):
#         base = self.binary + " -y"
#         if self.is_interactive(opts):
#             base = self.binary
# 
#         docs = True
#         if self.in_container(opts):
#             docs = False
# 
#         if opts and 'docs' in opts:
#             docs = opts['docs']
# 
#         docs_string = ""
#         if not docs:
#             docs_string = " --setopt=tsflags=nodocs"
# 
#         return base + docs_string
# 
#     def action(self, action, pkgs, options):
#         return "{0} {1} {2}".format(
#             self._base_command(options),
#             action,
#             " ".join(pkgs),
#         ).strip()
# 
#     def install(self, pkgs, options=None):
#         return self.action("install", pkgs, options)
# 
#     def reinstall(self, pkgs, options=None):
#         return self.action("reinstall", pkgs, options)
# 
#     def remove(self, pkgs, options=None):
#         return self.action("remove", pkgs, options)
# 
#     def update(self, pkgs, options=None):
#         return self.action("update", pkgs, options)
# 
#     def update_all(self, options=None):
#         return self.action("update", [], options)
# 
#     def cleancache(self, options=None):
#         return self._base_command(options) + " clean all --enablerepo='*'"


# Path: tests/unittests/test_commands.py
import pytest
from distgen.commands import DnfPkgManager, YumPkgManager



class TestIndividualPkgManagers(object):
    def setup_method(self, method):
        class Config(object):
            def __init__(self, interactive, container=None):
                self.interactive = interactive
                self.container = container

        self.mgrs = {'yumi': YumPkgManager(Config(True)),
                     'yumni': YumPkgManager(Config(False)),

                     'dnfi': DnfPkgManager(Config(True)),