def test_openshift(self): import os import mock orig_setup = pushitbot.setup def new_setup(*args, **kwargs): self.bot = self.prepare_bot(orig_setup(*args, **kwargs)) return self.bot os.environ['OPENSHIFT_POSTGRESQL_DB_HOST'] = 'localhost' os.environ['OPENSHIFT_POSTGRESQL_DB_PORT'] = '123' os.environ['PGDATABASE'] = 'test' os.environ['TGTOKEN'] = 'fakeToken' os.environ['OPENSHIFT_APP_DNS'] = 'something.rhcloud.com' with mock.patch('pushitbot.setup', new_setup): pushitbot.openshift_app() r = self.pop_reply() self.assertEqual(r[0], 'setWebhook') self.assertEqual(r[1]['url'], 'https://something.rhcloud.com/update/fakeToken')
#!/usr/bin/python # wsgi.py file is required by openshift import os virtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/' virtualenv = os.path.join(virtenv, 'bin/activate_this.py') try: execfile(virtualenv, dict(__file__=virtualenv)) except IOError: pass # # IMPORTANT: Put any additional includes below this line. If placed above this # line, it's possible required libraries won't be in your searchable path # from pushitbot import openshift_app application = openshift_app()