def test_creates_client_with_key_provided(self):
        key = create_private_key()

        self.command.execute(client="client", key=key)

        c = AuthorizedClient.objects.get(client_id="client")
        self.assertEqual(key, c.private_key)
Beispiel #2
0
    def test_creates_client_with_key_provided(self):
        key = create_private_key()

        self.command.execute(client="client", key=key)

        c = AuthorizedClient.objects.get(client_id="client")
        self.assertEqual(key, c.private_key)
Beispiel #3
0
    def handle(self, *args, **options):
        client = options.get("client")
        key = options.get("key")
        if not client:
            raise CommandError("Client is required.")

        if not key:
            key = create_private_key()

        client = AuthorizedClient.objects.create(client_id=client,
                                                 private_key=key)
        self.stdout.write("\nYour client id is: '{0}'\n".format(
            client.client_id))
        self.stdout.write("Your private key is: '{0}'\n".format(
            client.private_key))