示例#1
0
 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)
示例#2
0
    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)
示例#3
0
 def create_app(self):
     return create_app(root_dir=path_to_site)
示例#4
0
 def create_app(self):
     return create_app('/tmp/blah', config=self)
示例#5
0
文件: cli.py 项目: drivet/yawt
def create_app():
    return yawt.create_app(_root_dir())
示例#6
0
文件: test_git.py 项目: drivet/yawt
 def create_app(self):
     self.site = TestFolder()
     self.site.initialize()
     return create_app(self.site.site_root, config=self)
示例#7
0
文件: test_git.py 项目: drivet/yawt
 def create_app(self):
     self.root_dir = '/tmp/blah'
     return create_app(self.root_dir, config=self)
示例#8
0
 def setUp(self):
     self.plugin = YawtMarkdown()
     self.app = create_app('/tmp', extension_info=extension_info(self.plugin))
示例#9
0
文件: utils.py 项目: drivet/yawt
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)
示例#10
0
 def setUp(self):
     self.plugin = YawtExcerpt()
     self.app = create_app('/tmp', extension_info = extension_info(self.plugin))
示例#11
0
文件: __init__.py 项目: drivet/yawt
 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)
示例#12
0
 def create_app(self):
     self.root_dir = '/tmp/temp_site'
     return create_app(self.root_dir)
示例#13
0
文件: yawt_tests.py 项目: drivet/yawt
 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'])
示例#14
0
文件: yawt_tests.py 项目: drivet/yawt
 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'])