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)
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)
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)
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)