Example #1
0
	def test_set_cookie(self):
		response = Response(self, self.controller.string_no_args)
		expire_time = get_gmt_now() + timedelta(hours=1)
		expire_string = format_date(expire_time)
		response.set_cookie('some_cookie', 'some_data_for_cookie', 1)
		cookie_string = 'some_cookie=some_data_for_cookie; Expires=%s; Path=/' % expire_string
		assert cookie_string == response.headers['Set-Cookie']
Example #2
0
	def test_set_cookie(self):
		response = Response(self, self.controller.string_no_args)
		expire_time = get_gmt_now() + timedelta(hours=1)
		expire_string = format_date(expire_time)
		response.set_cookie('some_cookie', 'some_data_for_cookie', 1)
		cookie_string = 'some_cookie=some_data_for_cookie; Expires=%s; Path=/' % expire_string
		assert cookie_string == response.headers['Set-Cookie'].value
Example #3
0
	def setUp(self):
		app.request = DotDict({
			'headers': {},
			'cookies': {}
		})

		app.response = Response.from_data(
			'200 OK',
			{'Content-Type': 'text/html'},
			'This is a test response'
		)

		self.session_interface = app.drivers.session
Example #4
0
	def setUp(self):
		_environ['wsgi.input'].seek(0)
		self.request = Request(_environ)
		self.response = Response(app, Controller().string_no_args)
Example #5
0
	def test_delete_cookie(self):
		response = Response(self, self.controller.string_no_args)
		cookie_string = 'some_cookie=deleted; Expires=Thu, Jan 01 1970 00:00:00 GMT'
		response.delete_cookie('some_cookie')
		assert cookie_string == response.headers['Set-Cookie']
Example #6
0
	def test_dictionary_args(self):
		response = Response(self.app, self.controller.dictionary_args, {'data': 'some data'})
		assert 'Test: some data' == response.body
Example #7
0
	def test_string_args(self):
		response = Response(self.app, self.controller.string_args, {'data': 'some data'})
		assert 'Test: some data' == response.body
Example #8
0
	def test_dictionary_no_args(self):
		response = Response(self.app, self.controller.dictionary_no_args)
Example #9
0
	def test_string_no_args(self):
		response = Response(self.app, self.controller.string_no_args)
		assert 'Hello, world!' == response.body
Example #10
0
	def test_no_controller(self):
		with self.assertRaises(frame.Error404):
			response = Response(self.app, None)
Example #11
0
	def test_delete_cookie(self):
		response = Response(self, self.controller.string_no_args)
		cookie_string = 'some_cookie=deleted; Expires=Thu, Jan 01 1970 00:00:00 GMT'
		response.delete_cookie('some_cookie')
		assert cookie_string == response.headers['Set-Cookie'].value
Example #12
0
 def setUp(self):
     app.request = DotDict({'headers': {}, 'cookies': {}})
     app.response = Response(app, 'junk')
     self.session_interface = SessionInterface(app)