Example #1
0
    def _setup_relay(self, internal, add_org_key):
        self.key_pair = generate_key_pair()

        self.public_key = self.key_pair[1]
        self.private_key = self.key_pair[0]
        self.relay_id = six.binary_type(uuid4())

        self.relay = Relay.objects.create(relay_id=self.relay_id,
                                          public_key=six.binary_type(
                                              self.public_key),
                                          is_internal=internal)

        self.project = self.create_project()
        self.project.update_option('sentry:scrub_ip_address', True)
        self.path = reverse('sentry-api-0-relay-projectconfigs')

        org = self.project.organization

        if add_org_key:
            org.update_option('sentry:trusted-relays', [self.relay.public_key])
def key_pair():
    return generate_key_pair()