def setUp(self): super().setUp() self.app = Meetling(redis_url='15') self.app.r.flushdb() self.app.update() self.staff_member = self.app.login() self.user = self.app.login()
def test_update_db_version_first(self): self.setup_db('0.16.4') app = Meetling(redis_url='15') app.update() # Update to version 5 self.assertIsNone(app.settings.staff[0].email)
def test_update_db_version_previous(self): self.setup_db("0.11.3") app = Meetling(redis_url="15") app.update() settings = app.settings user = settings.staff[0] self.assertIsNone(user.email)
class MeetlingTestCase(AsyncTestCase): def setUp(self): super().setUp() self.app = Meetling(redis_url="15") self.app.r.flushdb() self.app.update() self.staff_member = self.app.login() self.user = self.app.login()
def main(args): args = {'redis_url': os.environ['REDISURL']} if 'REDISURL' in os.environ else {} app = Meetling(**args) app.r.flushdb() app.update() staff_member = app.login() staff_member.edit(name='Ceiling') app.settings.edit(title='Meetling Lab') user = app.login() user.edit(name='Happy') meeting1 = app.create_example_meeting() meeting2 = app.create_meeting('Cat hangout') meeting2.create_agenda_item('Eating') meeting2.create_agenda_item('Purring', duration=10, description='No snooping!') meeting2.trash_agenda_item(meeting2.create_agenda_item('Eatzing')) meeting2.trash_agenda_item(meeting2.create_agenda_item('Purring', duration=10, description='No snoopzing!')) text = [ 'To log in as staff member, visit:', '', 'http://localhost:8080/#login={}'.format(staff_member.auth_secret), '', 'Meetings:', '' ] for meeting in [meeting1, meeting2]: text.append('* {}: http://localhost:8080/meetings/{}'.format(meeting.title, meeting.id)) print('\n'.join(text)) return 0
def test_update_db_version_first(self): self.setup_db("0.5.0") app = Meetling(redis_url="15") app.update() settings = app.settings user = settings.staff[0] meeting = next(m for m in app.meetings.values() if m.title == "Cat hangout") item = list(meeting.items.values())[0] # Update to version 2 self.assertEqual(user.name, "Guest") self.assertEqual(user.authors, [user]) # Update to version 3 self.assertIsNone(meeting.time) self.assertIsNone(meeting.location) self.assertIsNone(item.duration) # Update to version 4 self.assertFalse(settings.trashed) self.assertFalse(user.trashed) self.assertFalse(meeting.trashed) self.assertFalse(item.trashed) # Update to version 5 self.assertIsNone(user.email)
def __init__(self, port=8080, url=None, debug=False, **args): # pylint: disable=super-init-not-called; Configurable classes use initialize() instead of # __init__() url = url or 'http://*****:*****@' + urlparts.hostname, render_email_auth_message=self._render_email_auth_message, **args) self._message_templates = DictLoader(meetling.server.templates.MESSAGE_TEMPLATES, autoescape=None)
def make_server(port=8080, url=None, client_path='client', debug=False, redis_url='', smtp_url=''): """Create a Meetling server.""" app = Meetling(redis_url, smtp_url=smtp_url) handlers = [ (r'/api/meetings$', _MeetingsEndpoint), (r'/api/create-example-meeting$', _CreateExampleMeetingEndpoint), (r'/api/meetings/([^/]+)$', _MeetingEndpoint), (r'/api/meetings/([^/]+)/items(/trashed)?$', _MeetingItemsEndpoint), (r'/api/meetings/([^/]+)/trash-agenda-item$', _MeetingTrashAgendaItemEndpoint), (r'/api/meetings/([^/]+)/restore-agenda-item$', _MeetingRestoreAgendaItemEndpoint), (r'/api/meetings/([^/]+)/move-agenda-item$', _MeetingMoveAgendaItemEndpoint), (r'/api/meetings/([^/]+)/items/([^/]+)$', _AgendaItemEndpoint) ] return Server(app, handlers, port, url, client_path, 'node_modules', debug)
def test_update_db_fresh(self): app = Meetling(redis_url="15") app.r.flushdb() app.update() self.assertEqual(app.settings.title, "My Meetling")
def test_update_db_version_previous(self): self.setup_db('0.16.4') app = Meetling(redis_url='15') app.update() self.assertIsNone(app.settings.staff[0].email)
def test_update_db_fresh(self): app = Meetling(redis_url='15') app.r.flushdb() app.update() self.assertEqual(app.settings.title, 'My Meetling')
class MeetlingServer(HTTPServer): """Meetling server. .. attribute:: app Underlying :class:`meetling.Meetling` application. .. attribute:: port See ``--port`` command line option. .. attribute:: url See ``--url`` command line option. .. attribute:: debug See ``--debug`` command line option. Additional *args* are passed to the :class:`meetling.Meetling` constructor and any errors raised by it are passed through. """ def __init__(self, port=8080, url=None, debug=False, **args): # pylint: disable=super-init-not-called; Configurable classes use initialize() instead of # __init__() url = url or 'http://*****:*****@' + urlparts.hostname, render_email_auth_message=self._render_email_auth_message, **args) self._message_templates = DictLoader(meetling.server.templates.MESSAGE_TEMPLATES, autoescape=None) def initialize(self, *args, **kwargs): # Configurable classes call initialize() instead of __init__() self.__init__(*args, **kwargs) def run(self): """Run the server.""" self.app.update() self.listen(self.port) IOLoop.instance().start() def _render_email_auth_message(self, email, auth_request, auth): template = self._message_templates.load('email_auth') msg = template.generate(email=email, auth_request=auth_request, auth=auth, app=self.app, server=self).decode() return '\n\n'.join([filter_whitespace('oneline', p.strip()) for p in re.split(r'\n{2,}', msg)])