Example #1
0
    def test_bad_kojitag(self):
        directive = yumrepoinfo_directive.YumrepoinfoDirective(
            filelist=[self.temp_conf.strpath])
        ref_input = {"koji_tag": "my random tag"}

        with pytest.raises(CheckbDirectiveError):
            directive.process(ref_input, None)
Example #2
0
    def test_missing_arch(self):
        directive = yumrepoinfo_directive.YumrepoinfoDirective(
            filelist=[self.temp_conf.strpath])
        ref_input = {"koji_tag": "rawhide"}

        with pytest.raises(CheckbDirectiveError):
            directive.process(ref_input, None)
Example #3
0
    def test_missing_kojitag(self):
        directive = yumrepoinfo_directive.YumrepoinfoDirective(
            filelist=[self.temp_conf.strpath])
        ref_input = {"arch": "x86_64"}

        with pytest.raises(CheckbDirectiveError):
            directive.process(ref_input, None)
Example #4
0
    def test_only_meta_arches(self):
        directive = yumrepoinfo_directive.YumrepoinfoDirective(
            filelist=[self.temp_conf.strpath])
        ref_input = {"koji_tag": "f20", "arch": ["src", "noarch"]}

        with pytest.raises(CheckbDirectiveError):
            directive.process(ref_input, None)
Example #5
0
    def test_rawhide(self):
        directive = yumrepoinfo_directive.YumrepoinfoDirective(
            filelist=[self.temp_conf.strpath])
        ref_input = {"koji_tag": "rawhide", "arch": "x86_64"}

        output = directive.process(ref_input, None)

        assert output == {
            "rawhide": {
                "x86_64":
                "http://download.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os"
            }
        }
Example #6
0
    def test_pending(self):
        directive = yumrepoinfo_directive.YumrepoinfoDirective(
            filelist=[self.temp_conf.strpath])
        ref_input = {"koji_tag": "f20-pending", "arch": "x86_64"}

        output = directive.process(ref_input, None)

        assert output == {
            "f20": {
                "x86_64":
                "http://download.fedoraproject.org/pub/fedora/linux/releases/20/Everything/x86_64/os"
            }
        }
Example #7
0
    def test_multiple_base_meta_arches(self):
        directive = yumrepoinfo_directive.YumrepoinfoDirective(
            filelist=[self.temp_conf.strpath])
        ref_input = {"koji_tag": "f20", "arch": ["src", "i386", "x86_64"]}

        output = directive.process(ref_input, None)

        assert output == {
            "f20": {
                "i386":
                "http://download.fedoraproject.org/pub/fedora-secondary/releases/20/"
                "Everything/i386/os",
                "x86_64":
                "http://download.fedoraproject.org/pub/fedora/linux/releases/20/"
                "Everything/x86_64/os"
            }
        }
Example #8
0
    def test_use_arch(self, monkeypatch):
        """Make sure that the arch passed in as an arg is used to create the
        yumrepoinfo object instead of falling back to the default system arch"""
        ref_arch = 'i386'
        repoinfo = yumrepoinfo.YumRepoInfo(filelist=[], arch='x86_64')
        if (sys.version_info >= (3, 2)):
            repoinfo.parser.read_file(StringIO(TEST_CONF))
        else:
            repoinfo.parser.readfp(StringIO(TEST_CONF))

        stub_getrepoinfo = mock.MagicMock(return_value=repoinfo)
        monkeypatch.setattr(yumrepoinfo, 'get_yumrepoinfo', stub_getrepoinfo)

        # don't set the repoinfo object, we've stubbed out the code that would
        # hit the filesystem, so it's not a risk here
        directive = yumrepoinfo_directive.YumrepoinfoDirective()
        ref_input = {"koji_tag": "f20-updates", "arch": ref_arch}

        directive.process(ref_input, None)

        # check the first arg of the first call to the stub object
        assert stub_getrepoinfo.call_args_list[0][0][0] == ref_arch