Esempio n. 1
0
    def test_create(self):
        user = User.objects.create_user('test', 'test')

        client = Client(user=user, app_name='Terrible App')
        client.save()

        self.assertEqual(len(client.api_key), 20)
        self.assertEqual(client.user.id, user.id)
Esempio n. 2
0
    def test_uniqueness(self):
        user1 = User.objects.create_user('user1', 'xxx')
        client1 = Client(user=user1, app_name='Cromulent', api_key='derp')
        client1.save()

        user2 = User.objects.create_user('user2', 'xxx')
        client2 = Client(user=user2, app_name='Fungible', api_key='derp')
        client2.save()