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

@override_settings(DEBUG=True)
@distributed_server_test
@unittest.skipIf((version_diff('0.13', VERSION) > 0), 'generate_zone    not    available    before    v0.13.')
def test_invalid_invitation(self):

    own_device = Device.get_own_device()
    call_command('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()
    with self.assertRaises(ValidationError):
        ZoneInvitation.generate(zone=zone, invited_by=new_device)
    invitation = ZoneInvitation(zone=zone, invited_by=new_device)
    with self.assertRaises(ValidationError):
        invitation.set_key(Key())
