예제 #1
0
파일: test_vars.py 프로젝트: smurfix/pybble
	def test_blueprint_vars(self):
		from pybble.core.models.site import Site, SiteBlueprint
		s = Site.q.get_by(name=u"test")
		b = SiteBlueprint.q.get_by(name=u"VarsTest",site=s)
		assert b.path=="/doc"

		assert b.config.color == "yellow"
		self.run_manager("mgr -Dt -s test blueprint param VarsTest color green")
		assert refresh(b).config.color == "green"
		self.run_manager("mgr -Dt -s test blueprint param VarsTest color foo")
		assert refresh(b).config.color == "foo"
		self.run_manager("mgr -Dt -s test blueprint param VarsTest color -")
		assert refresh(b).config.color == "yellow"
		with pytest.raises(NoData):
			self.run_manager("mgr -Dt -s test blueprint param VarsTest nuppsi fu") # does not exist
예제 #2
0
파일: test_vars.py 프로젝트: smurfix/pybble
	def test_site_vars(self):
		from pybble.core.models.site import Site, SiteBlueprint
		s = Site.q.get_by(name=u"test")

		res = s.config.appiti
		assert res == "pappiti"
		self.run_manager("mgr -Dt -s test site param appiti foo")
		res = refresh(s).config.appiti
		assert res == "foo"
		self.run_manager("mgr -Dt -s test site param appiti bar")
		assert refresh(s).config.appiti == "bar"
		self.run_manager("mgr -Dt -s test site param appiti -")
		assert refresh(s).config.appiti == "pappiti"
		with pytest.raises(NoData):
			self.run_manager("mgr -Dt -s test site param nuppi foo") # does not exist
예제 #3
0
파일: test_user.py 프로젝트: smurfix/pybble
	def test_password(self):
		self.once(u_test)
		u = User.q.get_by(username="******")
		assert u.password is None
		self.run_manager("mgr -Dt -s UserTest obj -q update User {} password=blafasel".format(u.id))
		u = refresh(u, force=True)
		assert ":" in u.password # make sure it's hashed
예제 #4
0
    def test_site_vars(self):
        from pybble.core.models.site import Site, SiteBlueprint
        s = Site.q.get_by(name=u"test")

        res = s.config.appiti
        assert res == "pappiti"
        self.run_manager("mgr -Dt -s test site param appiti foo")
        res = refresh(s).config.appiti
        assert res == "foo"
        self.run_manager("mgr -Dt -s test site param appiti bar")
        assert refresh(s).config.appiti == "bar"
        self.run_manager("mgr -Dt -s test site param appiti -")
        assert refresh(s).config.appiti == "pappiti"
        with pytest.raises(NoData):
            self.run_manager(
                "mgr -Dt -s test site param nuppi foo")  # does not exist
예제 #5
0
 def test_password(self):
     self.once(u_test)
     u = User.q.get_by(username="******")
     assert u.password is None
     self.run_manager(
         "mgr -Dt -s UserTest obj -q update User {} password=blafasel".
         format(u.id))
     u = refresh(u, force=True)
     assert ":" in u.password  # make sure it's hashed
예제 #6
0
    def test_blueprint_vars(self):
        from pybble.core.models.site import Site, SiteBlueprint
        s = Site.q.get_by(name=u"test")
        b = SiteBlueprint.q.get_by(name=u"VarsTest", site=s)
        assert b.path == "/doc"

        assert b.config.color == "yellow"
        self.run_manager(
            "mgr -Dt -s test blueprint param VarsTest color green")
        assert refresh(b).config.color == "green"
        self.run_manager("mgr -Dt -s test blueprint param VarsTest color foo")
        assert refresh(b).config.color == "foo"
        self.run_manager("mgr -Dt -s test blueprint param VarsTest color -")
        assert refresh(b).config.color == "yellow"
        with pytest.raises(NoData):
            self.run_manager(
                "mgr -Dt -s test blueprint param VarsTest nuppsi fu"
            )  # does not exist
예제 #7
0
파일: __init__.py 프로젝트: smurfix/pybble
	def __call__(self, environ, start_response):
		if self._parent is None:
			with self.app_context():
				s = refresh(self.site)
				self._parent = self.pybble_dispatcher.get_application(site=s.parent)
		return self._parent(environ, start_response)