diff options
| author | Mjumbe Wawatu Poe | 2012-09-07 13:15:24 -0400 |
|---|---|---|
| committer | Mjumbe Wawatu Poe | 2012-09-07 13:15:24 -0400 |
| commit | 5a3874ee112490937f83fa5700899f3631a14128 (patch) | |
| tree | 9d1c987a5501d3136ef48bbeb1d77a209aa9ec13 /djangorestframework/tests/authentication.py | |
| parent | f3e65eab6b60a23eeed2178db4f6034ce2c6ac3d (diff) | |
| download | django-rest-framework-5a3874ee112490937f83fa5700899f3631a14128.tar.bz2 | |
Create a key by default if none is specified
Diffstat (limited to 'djangorestframework/tests/authentication.py')
| -rw-r--r-- | djangorestframework/tests/authentication.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/djangorestframework/tests/authentication.py b/djangorestframework/tests/authentication.py index 2806da36..fb9996be 100644 --- a/djangorestframework/tests/authentication.py +++ b/djangorestframework/tests/authentication.py @@ -146,3 +146,8 @@ class TokenAuthTests(TestCase): """Ensure POSTing json over token auth without correct credentials fails""" response = self.csrf_client.post('/', json.dumps({'example': 'example'}), 'application/json') self.assertEqual(response.status_code, 403) + + def test_token_has_auto_assigned_key_if_none_provided(self): + """Ensure creating a token with no key will auto-assign a key""" + token = Token.objects.create(user=self.user) + self.assertEqual(len(token.key), 32) |
