py.test -F testing
Details
Details
Diff Detail
Diff Detail
- Repository
- rLTRN libtaskotron
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
| kparal |
py.test -F testing
| Automatic diff as part of commit; lint not applicable. |
| Automatic diff as part of commit; unit tests not applicable. |
| Path | Packages | |||
|---|---|---|---|---|
| M | testing/test_bodhi_directive.py (18 lines) | |||
| M | testing/test_koji_directive.py (12 lines) |
| Commit | Tree | Parents | Author | Summary | Date |
|---|---|---|---|---|---|
| 56c9bc1bc950 | e2da5d681b00 | e01d29285fc6 | Lukas Brabec | removing broken (and unnecessary) tests (Show More…) | Mar 12 2015, 2:46 PM |
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- | ||
|---|---|---|---|---|---|
| 2 | # Copyright 2009-2014, Red Hat, Inc. | 2 | # Copyright 2009-2014, Red Hat, Inc. | ||
| 3 | # License: GPL-2.0+ <http://spdx.org/licenses/GPL-2.0+> | 3 | # License: GPL-2.0+ <http://spdx.org/licenses/GPL-2.0+> | ||
| 4 | # See the LICENSE file for more details on Licensing | 4 | # See the LICENSE file for more details on Licensing | ||
| 5 | 5 | | |||
| 6 | '''Unit tests for libtaskotron/directives/bodhi_directive.py''' | 6 | '''Unit tests for libtaskotron/directives/bodhi_directive.py''' | ||
| 7 | 7 | | |||
| 8 | import pytest | 8 | import pytest | ||
| 9 | from dingus import Dingus | 9 | from dingus import Dingus | ||
| 10 | 10 | | |||
| 11 | from libtaskotron.directives import bodhi_directive | 11 | from libtaskotron.directives import bodhi_directive | ||
| 12 | from libtaskotron.exceptions import TaskotronDirectiveError, TaskotronValueError | 12 | from libtaskotron.exceptions import TaskotronDirectiveError | ||
| 13 | 13 | | |||
| 14 | class TestBodhiDownloads(): | 14 | class TestBodhiDownloads(): | ||
| 15 | 15 | | |||
| 16 | def setup_method(self, method): | 16 | def setup_method(self, method): | ||
| 17 | '''Run this before every test invocation''' | 17 | '''Run this before every test invocation''' | ||
| 18 | self.ref_arch = ['x86_64'] | 18 | self.ref_arch = ['x86_64'] | ||
| 19 | self.ref_bodhi_id = 'FEDORA-1234-56789' | 19 | self.ref_bodhi_id = 'FEDORA-1234-56789' | ||
| 20 | self.ref_workdir = '/var/tmp/foo' | 20 | self.ref_workdir = '/var/tmp/foo' | ||
| ▲ Show 20 Lines • Show All 170 Lines • ▼ Show 20 Line(s) | 175 | def test_action_download_insufficient_input_data(self): | |||
| 191 | with pytest.raises(TaskotronDirectiveError): | 191 | with pytest.raises(TaskotronDirectiveError): | ||
| 192 | test_bodhi.process(ref_input, self.ref_envdata) | 192 | test_bodhi.process(ref_input, self.ref_envdata) | ||
| 193 | 193 | | |||
| 194 | ref_input.pop('arch') | 194 | ref_input.pop('arch') | ||
| 195 | ref_input['bodhi_id'] = self.ref_bodhi_id | 195 | ref_input['bodhi_id'] = self.ref_bodhi_id | ||
| 196 | 196 | | |||
| 197 | with pytest.raises(TaskotronDirectiveError): | 197 | with pytest.raises(TaskotronDirectiveError): | ||
| 198 | test_bodhi.process(ref_input, self.ref_envdata) | 198 | test_bodhi.process(ref_input, self.ref_envdata) | ||
| 199 | | ||||
| 200 | def test_empty_arch_no_src(self): | | |||
| 201 | self.ref_arch = [] | | |||
| 202 | self.ref_input = {'action': 'download', | | |||
| 203 | 'arch': self.ref_arch, | | |||
| 204 | 'bodhi_id': self.ref_bodhi_id, | | |||
| 205 | 'src': False | | |||
| 206 | } | | |||
| 207 | | ||||
| 208 | stub_bodhi = Dingus(query_update__returns=self.ref_update) | | |||
| 209 | stub_koji = Dingus(get_nvr_rpms__returns=[self.ref_rpmfile]) | | |||
| 210 | | ||||
| 211 | test_bodhi = bodhi_directive.BodhiDirective(stub_bodhi, stub_koji) | | |||
| 212 | | ||||
| 213 | with pytest.raises(TaskotronValueError): | | |||
| 214 | test_bodhi.process(self.ref_input, self.ref_envdata) | | |||
| 215 | No newline at end of file | | |||
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- | ||
|---|---|---|---|---|---|
| 2 | # Copyright 2009-2014, Red Hat, Inc. | 2 | # Copyright 2009-2014, Red Hat, Inc. | ||
| 3 | # License: GPL-2.0+ <http://spdx.org/licenses/GPL-2.0+> | 3 | # License: GPL-2.0+ <http://spdx.org/licenses/GPL-2.0+> | ||
| 4 | # See the LICENSE file for more details on Licensing | 4 | # See the LICENSE file for more details on Licensing | ||
| 5 | 5 | | |||
| 6 | from dingus import Dingus | 6 | from dingus import Dingus | ||
| 7 | import pytest | | |||
| 8 | 7 | | |||
| 9 | from libtaskotron.directives import koji_directive | 8 | from libtaskotron.directives import koji_directive | ||
| 10 | from libtaskotron.exceptions import TaskotronValueError | | |||
| 11 | 9 | | |||
| 12 | class TestKojiDirective(): | 10 | class TestKojiDirective(): | ||
| 13 | def setup_method(self, method): | 11 | def setup_method(self, method): | ||
| 14 | self.ref_nvr = 'foo-1.2-3.fc99' | 12 | self.ref_nvr = 'foo-1.2-3.fc99' | ||
| 15 | self.ref_arch = ['noarch'] | 13 | self.ref_arch = ['noarch'] | ||
| 16 | self.ref_tag = 'tagfoo' | 14 | self.ref_tag = 'tagfoo' | ||
| 17 | self.ref_name = 'foo' | 15 | self.ref_name = 'foo' | ||
| 18 | self.ref_version = '1.2' | 16 | self.ref_version = '1.2' | ||
| ▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Line(s) | 123 | def test_add_noarch_download_tag_command(self): | |||
| 133 | 131 | | |||
| 134 | getrpm_calls = stub_koji.calls() | 132 | getrpm_calls = stub_koji.calls() | ||
| 135 | requested_arches = getrpm_calls[0][2]['arches'] | 133 | requested_arches = getrpm_calls[0][2]['arches'] | ||
| 136 | 134 | | |||
| 137 | assert len(getrpm_calls) == 1 | 135 | assert len(getrpm_calls) == 1 | ||
| 138 | assert 'x86_64' in requested_arches | 136 | assert 'x86_64' in requested_arches | ||
| 139 | assert 'noarch' in requested_arches | 137 | assert 'noarch' in requested_arches | ||
| 140 | 138 | | |||
| 141 | def test_empty_arch_no_src(self): | | |||
| 142 | ref_input = {'action': 'download', 'arch': [], 'src': False, | | |||
| 143 | 'koji_build': self.ref_nvr} | | |||
| 144 | ref_envdata = {'workdir': '/var/tmp/foo'} | | |||
| 145 | | ||||
| 146 | stub_koji = Dingus() | | |||
| 147 | test_helper = koji_directive.KojiDirective(stub_koji) | | |||
| 148 | with pytest.raises(TaskotronValueError): | | |||
| 149 | test_helper.process(ref_input, ref_envdata) | | |||
| 150 | | ||||
| 151 | def test__download_command_src(self): | 139 | def test__download_command_src(self): | ||
| 152 | ref_input = {'action': 'download', 'arch': [], 'src': True, | 140 | ref_input = {'action': 'download', 'arch': [], 'src': True, | ||
| 153 | 'koji_build': self.ref_nvr} | 141 | 'koji_build': self.ref_nvr} | ||
| 154 | ref_envdata = {'workdir': '/var/tmp/foo'} | 142 | ref_envdata = {'workdir': '/var/tmp/foo'} | ||
| 155 | 143 | | |||
| 156 | stub_koji = Dingus() | 144 | stub_koji = Dingus() | ||
| 157 | test_helper = koji_directive.KojiDirective(stub_koji) | 145 | test_helper = koji_directive.KojiDirective(stub_koji) | ||
| 158 | test_helper.process(ref_input, ref_envdata) | 146 | test_helper.process(ref_input, ref_envdata) | ||
| 159 | 147 | | |||
| 160 | getrpm_calls = stub_koji.calls() | 148 | getrpm_calls = stub_koji.calls() | ||
| 161 | requested_arches = getrpm_calls[0][2]['arches'] | 149 | requested_arches = getrpm_calls[0][2]['arches'] | ||
| 162 | requested_src = getrpm_calls[0][2]['src'] | 150 | requested_src = getrpm_calls[0][2]['src'] | ||
| 163 | 151 | | |||
| 164 | assert len(getrpm_calls) == 1 | 152 | assert len(getrpm_calls) == 1 | ||
| 165 | assert [] == requested_arches | 153 | assert [] == requested_arches | ||
| 166 | assert requested_src | 154 | assert requested_src | ||