예제 #1
0
	def stringReceived(self, s):
		msgType, body = strictSecureDecodeJson(s)
		if msgType == "Point":
			self._handleNewCircle(body)
		elif msgType == "ClearBoard":
			self.factory.clearBoard(dontTell=(self,))
예제 #2
0
	def test_rejectsTrailingBytes(self):
		self.assertRaises(StrictDecodeError, lambda: strictSecureDecodeJson('{"a": {}} '))
		self.assertRaises(StrictDecodeError, lambda: strictSecureDecodeJson('{"a": {}}\n'))
		self.assertRaises(StrictDecodeError, lambda: strictSecureDecodeJson('347681x'))
		self.assertEqual(347681, strictSecureDecodeJson('347681'))
예제 #3
0
	def test_usesSecuredict(self):
		out = strictSecureDecodeJson('{"a": {}}')
		self.assertEqual(securedict({"a": securedict()}), out)
		self.assertTrue(isinstance(out, securedict), type(out))
		self.assertTrue(isinstance(out["a"], securedict), type(out))
예제 #4
0
	def test_rejectsNanInf(self):
		self.assertRaises(StrictDecodeError, lambda: strictSecureDecodeJson('[NaN]'))
		self.assertRaises(StrictDecodeError, lambda: strictSecureDecodeJson('[Infinity]'))
		self.assertRaises(StrictDecodeError, lambda: strictSecureDecodeJson('[-Infinity]'))
예제 #5
0
 def stringReceived(self, s):
     msgType, body = strictSecureDecodeJson(s)
     if msgType == "SetPreferences":
         self._setPreferences(body)