예제 #1
0
 def test_recreate_authentication_v4_psk(self):
     device = SonyDevice("test", "test", "foobarPSK")
     device.pin = 1234
     self.add_register_to_device(device, 4)
     device._recreate_authentication()
     self.assertTrue(device.psk)
     self.assertEqual(device.headers["X-Auth-PSK"], device.psk)
예제 #2
0
    def test_recreate_authentication_v3(self):
        device = self.create_device()
        device.pin = 1234
        self.add_register_to_device(device, 3)
        device._recreate_authentication()

        self.assertEqual(device.headers["Authorization"], "Basic OjEyMzQ=")
        self.assertEqual(device.headers["X-CERS-DEVICE-ID"], device.client_id)
예제 #3
0
    def test_recreate_authentication_v4(self):
        device = self.create_device()
        device.pin = 1234
        self.add_register_to_device(device, 4)
        device._recreate_authentication()

        self.assertEqual(device.headers["Authorization"], "Basic OjEyMzQ=")
        self.assertEqual(device.headers["Connection"], "keep-alive")
        self.verify_cookies(device)
예제 #4
0
 def test_recreate_authentication_no_auth(self):
     versions = [1, 2]
     for version in versions:
         device = self.create_device()
         self.add_register_to_device(device, version)
         device._recreate_authentication()
         self.assertEqual(len(device.headers), 2)
         self.assertTrue(
             device.headers['X-CERS-DEVICE-ID'] == device.nickname)
         self.assertTrue(
             device.headers['X-CERS-DEVICE-INFO'] == device.nickname)