def test_notify_sends_notifications_for_specified_categories(self): self.tempdir = tempfile.mkdtemp() self.app = create_app(self.tempdir, config=Config()) self.notify = yawtext.notify.YawtNotify(self.app) with self.app.test_request_context(): changed = ChangedFiles(added=['content/cat1/a.txt', 'content/cat2/b.txt'], modified=['content/cat3/c.txt', 'content/cat4/d.txt'], deleted=['content/cat5/e.txt', 'content/cat6/f.txt']) self.notify.on_files_changed(changed) args_list = yawtext.notify.post_social.call_args_list self.assertEquals(1, len(args_list)) call = args_list[0] msg = call[0][0] self.assertTrue('cat1/a' in msg)
def test_notify_posts_message_on_networks(self): self.tempdir = tempfile.mkdtemp() self.app = create_app(self.tempdir) self.notify = yawtext.notify.YawtNotify(self.app) with self.app.test_request_context(): changed = ChangedFiles(added=['content/cat1/a.txt', 'content/cat2/b.txt'], modified=['content/cat3/c.txt','content/cat4/d.txt'], deleted=['content/cat5/e.txt', 'content/cat6/f.txt']) self.notify.on_files_changed(changed) args_list = yawtext.notify.post_social.call_args_list call = args_list[0] msg = call[0][0] self.assertTrue('cat1/a' in msg) call = args_list[1] msg = call[0][0] self.assertTrue('cat2/b' in msg)
def create_app(self): return create_app(root_dir=path_to_site)
def create_app(self): return create_app('/tmp/blah', config=self)
def create_app(): return yawt.create_app(_root_dir())
def create_app(self): self.site = TestFolder() self.site.initialize() return create_app(self.site.site_root, config=self)
def create_app(self): self.root_dir = '/tmp/blah' return create_app(self.root_dir, config=self)
def setUp(self): self.plugin = YawtMarkdown() self.app = create_app('/tmp', extension_info=extension_info(self.plugin))
def run_in_context(repo_path, func, *args, **kwargs): """run the function in a YAWT/Flask request context""" app = yawt.create_app(repo_path) with app.test_request_context(): current_app.preprocess_request() func(*args, **kwargs)
def setUp(self): self.plugin = YawtExcerpt() self.app = create_app('/tmp', extension_info = extension_info(self.plugin))
def create_app(self): self.site = BaseTestSite(files=self.files, folders=self.folders) self.site.initialize() return yawt.create_app(self.site.site_root, config=self)
def create_app(self): self.root_dir = '/tmp/temp_site' return create_app(self.root_dir)
def test_supplied_config_overrides_site_file(self): app = yawt.create_app(self.site.site_root, config=self) self.assertEquals('yet_other_drafts', app.config['YAWT_DRAFT_FOLDER']) self.assertEquals('http://www.foobar.com', app.config['YAWT_BASE_URL'])
def test_configuration_is_read_from_site_file(self): app = yawt.create_app(self.site.site_root) self.assertEquals('other_drafts', app.config['YAWT_DRAFT_FOLDER']) self.assertEquals('http://www.hereitis.com', app.config['YAWT_BASE_URL'])