예제 #1
0
 def test_has_broken_build_job(self, arg, expected, monkeypatch):
     monkeypatch.setenv('HOME', FIXTURES_DIR)
     monkeypatch.setattr('rhcephpkg.build.get_distribution',
                         lambda x: FakeDistribution(arg))
     build = Build(())
     result = build._has_broken_build_job()
     assert result is expected
예제 #2
0
 def test_wrong_branch(self, monkeypatch):
     monkeypatch.setattr('rhcephpkg.util.package_name', lambda: 'mypkg')
     monkeypatch.setattr('rhcephpkg.util.current_branch',
                         lambda: 'patch-queue/ceph-2-ubuntu')
     build = Build(['build'])
     with pytest.raises(SystemExit) as e:
         build.main()
     expected = 'You can switch to the debian branch with "gbp pq switch"'
     assert str(e.value) == expected
예제 #3
0
 def test_working_build(self, monkeypatch):
     monkeypatch.setattr('jenkins.Jenkins.build_job', self.fake_build_job)
     monkeypatch.setattr('rhcephpkg.util.package_name', lambda: 'mypkg')
     monkeypatch.setattr('rhcephpkg.util.current_branch',
                         lambda: 'ceph-2-ubuntu')
     build = Build(['build'])
     build.main()
     assert self.args == ('build-package',)
     assert self.kwargs == {'parameters': {'BRANCH': 'ceph-2-ubuntu',
                                           'PKG_NAME': 'mypkg'},
                            'token': '5d41402abc4b2a76b9719d911017c592'}
예제 #4
0
 def test_working_build(self, monkeypatch):
     monkeypatch.setenv('HOME', FIXTURES_DIR)
     monkeypatch.setattr('jenkins.Jenkins.build_job', self.fake_build_job)
     monkeypatch.setattr('rhcephpkg.util.package_name', lambda: 'mypkg')
     monkeypatch.setattr('rhcephpkg.util.current_branch',
                         lambda: 'ceph-2-ubuntu')
     build = Build(())
     build._run()
     assert self.args == ('build-package',)
     assert self.kwargs == {'parameters': {'BRANCH': 'ceph-2-ubuntu',
                                           'PKG_NAME': 'mypkg'},
                            'token': '5d41402abc4b2a76b9719d911017c592'}
예제 #5
0
 def test_has_broken_build_job(self, arg, expected, monkeypatch):
     monkeypatch.setattr('rhcephpkg.build.get_distribution',
                         lambda x: FakeDistribution(arg))
     build = Build(())
     result = build._has_broken_build_job()
     assert result is expected