Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
Well, shit
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Sinchok committed Mar 10, 2014
1 parent af00905 commit 794ae2d
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions tests/test_management_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@
class CreateTokenTestCase(TestCase):

def test_create_token(self):
with io.BytesIO() as f:
management.call_command("create_token", stdout=f)
self.assertEqual(ApiToken.objects.count(), 1)

self.assertTrue("Public token: " in f.getvalue())
self.assertTrue("Private token: " in f.getvalue())
management.call_command("create_token")
self.assertEqual(ApiToken.objects.count(), 1)

def test_create_specific_token(self):
with io.BytesIO() as f:
management.call_command("create_token", "noop", "noop", stdout=f)
self.assertEqual(ApiToken.objects.count(), 1)

self.assertEquals("Public token: noop\nPrivate token: noop\n", f.getvalue())
management.call_command("create_token", "noop", "noop")
self.assertEqual(ApiToken.objects.count(), 1)
self.assertEqual(ApiToken.objects.filter(private_token="noop", public_token="noop").count(), 1)

def test_command_error(self):
if django.VERSION[1] > 4:
Expand Down

0 comments on commit 794ae2d

Please sign in to comment.