Esempio n. 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)
Esempio n. 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)
Esempio n. 3
0
 def create_app(self):
     return create_app(root_dir=path_to_site)
Esempio n. 4
0
 def create_app(self):
     return create_app('/tmp/blah', config=self)
Esempio n. 5
0
File: cli.py Progetto: drivet/yawt
def create_app():
    return yawt.create_app(_root_dir())
Esempio n. 6
0
 def create_app(self):
     self.site = TestFolder()
     self.site.initialize()
     return create_app(self.site.site_root, config=self)
Esempio n. 7
0
 def create_app(self):
     self.root_dir = '/tmp/blah'
     return create_app(self.root_dir, config=self)
Esempio n. 8
0
 def setUp(self):
     self.plugin = YawtMarkdown()
     self.app = create_app('/tmp', extension_info=extension_info(self.plugin))
Esempio n. 9
0
File: utils.py Progetto: 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)
Esempio n. 10
0
 def setUp(self):
     self.plugin = YawtExcerpt()
     self.app = create_app('/tmp', extension_info = extension_info(self.plugin))
Esempio n. 11
0
 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)
Esempio n. 12
0
 def create_app(self):
     self.root_dir = '/tmp/temp_site'
     return create_app(self.root_dir)
Esempio n. 13
0
 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'])
Esempio n. 14
0
 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'])