Пример #1
0
    def test_get_comment(self, monkeypatch):
        self.ref_query = util.make_default_update()

        monkeypatch.setattr(mock_fedorainfra.boji, 'get_bodhi_connection', get_mock_bodhi)
        monkeypatch.setattr(mock_fedorainfra.database, 'db_url', 'file://%s' % self.db_fd)

        test_result = self.app.post('/bodhi/list', data={'package':'foo', 'limit':10})

        test_comments = json.loads(test_result.data)['updates'][0]['comments']
        assert len(test_comments) == 0
Пример #2
0
def get_mock_bodhi():
    return MockBodhi(util.make_default_update())
Пример #3
0
from datetime import datetime
import fedora.client

import mock_fedorainfra.koji.mock_koji as mock_koji
from sqlalchemy import desc
from mock_fedorainfra.database import db_session, init_db
from mock_fedorainfra.models import BodhiComment
from mock_fedorainfra import util

# configuration
DATABASE = '/tmp/boji.db'
DEBUG = True
SECRET_KEY = 'test key'
NUM_PAGE = 20

default_response = util.make_default_update()

koji_getbuild_resp = {'owner_name': 'cebbert', 'package_name': 'kernel', 'task_id': 3085371, 'creation_event_id': 3729725, 'creation_time': '2011-05-21 17:16:58.584573', 'epoch': None, 'nvr': 'kernel-2.6.35.13-92.fc14', 'name': 'kernel', 'completion_time': '2011-05-21 18:37:45.561815', 'state': 1, 'version': '2.6.35.13', 'release': '92.fc14', 'creation_ts': 1305998218.58457, 'package_id': 8, 'id': 244715, 'completion_ts': 1306003065.56182, 'owner_id': 417}

app = Flask(__name__)
#app.debug = True
app.config.from_object(__name__)
init_db()

handler = XMLRPCHandler('mockkoji')
handler.connect(app, '/mockkoji')

@app.teardown_request
def shutdown_session(exception=None):
    db_session.remove()