Skip to content

Instantly share code, notes, and snippets.

View guilatrova's full-sized avatar
🐍
Making Python learning easy

Guilherme Latrova guilatrova

🐍
Making Python learning easy
View GitHub Profile
@guilatrova
guilatrova / bad_django_self_tests.py
Created October 21, 2017 09:38
Example of bad test examples testing framework itself
def test_save_transaction(self):
t = Transaction.objects.create(description='django works', value=10, user=self.user)
self.assertIsNotNone(t.id)
self.assertEqual(Transaction.objects.count(), 1)
@guilatrova
guilatrova / bad_tests.py
Last active October 21, 2017 09:34
Example of bad Django Rest Framework tests
from transactions.models import Transaction
from rest_framework.authtoken.models import Token
from rest_framework.test import APITestCase, APIClient
from rest_framework import status
class IntegrationTests(APITestCase):
def setUp(self):
self.user = User.objects.create_user(username='testuser', email='testuser@test.com', password='testing')
token = Token.objects.create(user=self.user)