Beispiel #1
0
 def test_enum_getter_access(self):
     """ Test getter access. """
     test = koji.Enum(('one', 'two', 'three'))
     self.assertEquals(test.get('one'), 0)
     self.assertEquals(test.get('two'), 1)
     self.assertEquals(test.get('three'), 2)
     self.assertEquals(test.get('does not exist'), None)
Beispiel #2
0
    def test_enum_bracket_access(self):
        """ Test bracket access. """
        test = koji.Enum(('one', 'two', 'three'))
        self.assertEquals(test['one'], 0)
        self.assertEquals(test['two'], 1)
        self.assertEquals(test['three'], 2)

        with self.assertRaises(KeyError):
            test['does not exist']
Beispiel #3
0
from osbs.exceptions import OsbsValidationException

OSBS_VERSION = osbs.__version__
OSBS_FLATPAK_SUPPORT_VERSION = '0.43'  # based on OSBS 2536f24 released on osbs-0.43
if LooseVersion(OSBS_VERSION) < LooseVersion(OSBS_FLATPAK_SUPPORT_VERSION):
    osbs_flatpak_support = False
else:
    osbs_flatpak_support = True


# List of LABEL identifiers used within Koji. Values doesn't need to correspond
# to actual LABEL names. All these are required unless there exist default
# value (see LABEL_DEFAULT_VALUES).
LABELS = koji.Enum((
    'COMPONENT',
    'VERSION',
    'RELEASE',
    'NAME',
))

# list of labels which has to be explicitly defined with values
LABELS_EXPLICIT_REQUIRED = koji.Enum((
    'NAME',
    'COMPONENT',
))

# list of labels which has to be defined but value may be set via env
LABELS_ENV_REQUIRED = koji.Enum((
    'VERSION',
))

# Mapping between LABEL identifiers within koji and actual LABEL identifiers
Beispiel #4
0
try:
    from osbs.exceptions import OsbsOrchestratorNotEnabled
except ImportError:
    from osbs.exceptions import OsbsValidationException as OsbsOrchestratorNotEnabled
try:
    from osbs.utils import split_module_spec
    osbs_flatpak_support = True
except ImportError:
    osbs_flatpak_support = False

# List of LABEL identifiers used within Koji. Values doesn't need to correspond
# to actual LABEL names. All these are required unless there exist default
# value (see LABEL_DEFAULT_VALUES).
LABELS = koji.Enum((
    'COMPONENT',
    'VERSION',
    'RELEASE',
    'ARCHITECTURE',
))

# Mapping between LABEL identifiers within koji and actual LABEL identifiers
# which can be found in Dockerfile. First value is preferred one, others are for
# compatibility purposes.
LABEL_NAME_MAP = {
    'COMPONENT': ('com.redhat.component', 'BZComponent'),
    'VERSION': ('version', 'Version'),
    'RELEASE': ('release', 'Release'),
    'ARCHITECTURE': ('architecture', 'Architecture'),
}

# Map from LABELS to extra data
LABEL_DATA_MAP = {
Beispiel #5
0
 def test_enum_slice_access(self):
     """ Test slice access. """
     test = koji.Enum(('one', 'two', 'three'))
     self.assertEquals(test[1:], ('two', 'three'))
Beispiel #6
0
 def test_enum_create_alpha(self):
     """ Test that we can create an Enum with alphabet names """
     koji.Enum(('one', 'two', 'three'))