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