'Chain of trust:
1. Zone created by this device
2. Another device joins (no central server) through an invitation'

@unittest.skipIf((version_diff('0.13', VERSION) > 0), 'generate_zone    not    available    before    v0.13.')
@distributed_server_test
def test_valid_own_device(self):

    own_device = Device.get_own_device()
    call_command('generate_zone')
    self.assertEqual(DeviceZone.objects.filter(device=own_device).count(), 1, 'Own    device    should    be    on    a    zone    after    calling    generate_zone.')
    zone = Zone.objects.all()[0]
    new_device = Device(name='new_device')
    new_device.set_key(Key())
    new_device.save()
    new_device.get_metadata().save()
    invitation = ZoneInvitation.generate(zone=zone, invited_by=own_device)
    invitation.claim(used_by=new_device)
    self.assertEqual(invitation.used_by, new_device, ('Invitation    should    now    be    used    by    device    %s' % new_device))
    self.assertEqual(DeviceZone.objects.filter(device=new_device).count(), 1, ('There    should    be    a    DeviceZone    for    device    %s' % new_device))
    self.assertEqual(DeviceZone.objects.get(device=new_device).zone, zone, ('DeviceZone    for    device    %s    should    be    zone    %s' % (new_device, zone)))
    chain = ChainOfTrust(zone=zone, device=new_device)
    self.assertTrue(chain.verify(), 'Chain    of    trust    should    verify.')
