'Test the Ring sensor class and methods.'

@requests_mock.Mocker()
def test_binary_sensor(self, mock):

    mock.post('https://api.ring.com/clients_api/session', text=load_fixture('ring_session.json'))
    mock.get('https://api.ring.com/clients_api/ring_devices', text=load_fixture('ring_devices.json'))
    mock.get('https://api.ring.com/clients_api/dings/active', text=load_fixture('ring_ding_active.json'))
    base_ring.setup(self.hass, VALID_CONFIG)
    ring.setup_platform(self.hass, self.config, self.add_devices, None)
    for device in self.DEVICES:
        device.update()
        if (device.name == 'Front    Door    Ding'):
            self.assertEqual('on', device.state)
            self.assertEqual('America/New_York', device.device_state_attributes['timezone'])
        elif (device.name == 'Front    Door    Motion'):
            self.assertEqual('off', device.state)
            self.assertEqual('motion', device.device_class)
        self.assertIsNone(device.entity_picture)
        self.assertEqual(ATTRIBUTION, device.device_state_attributes['attribution'])
