Replaced model_mummy with factory_boy
This commit is contained in:
parent
a6d04ea1d7
commit
e9c3eb59a3
9 changed files with 87 additions and 48 deletions
|
|
@ -5,11 +5,12 @@ from django.core.urlresolvers import reverse
|
|||
from django.core.exceptions import ValidationError
|
||||
from django.utils import timezone
|
||||
|
||||
from model_mommy import mommy
|
||||
from funkwhale_api.music.tests.factories import TrackFactory
|
||||
|
||||
from funkwhale_api.users.models import User
|
||||
from funkwhale_api.history import models
|
||||
|
||||
|
||||
class TestHistory(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
@ -17,12 +18,12 @@ class TestHistory(TestCase):
|
|||
self.user = User.objects.create_user(username='test', email='test@test.com', password='test')
|
||||
|
||||
def test_can_create_listening(self):
|
||||
track = mommy.make('music.Track')
|
||||
track = TrackFactory()
|
||||
now = timezone.now()
|
||||
l = models.Listening.objects.create(user=self.user, track=track)
|
||||
|
||||
def test_anonymous_user_can_create_listening_via_api(self):
|
||||
track = mommy.make('music.Track')
|
||||
track = TrackFactory()
|
||||
url = self.reverse('api:v1:history:listenings-list')
|
||||
response = self.client.post(url, {
|
||||
'track': track.pk,
|
||||
|
|
@ -34,7 +35,7 @@ class TestHistory(TestCase):
|
|||
self.assertIsNotNone(listening.session_key)
|
||||
|
||||
def test_logged_in_user_can_create_listening_via_api(self):
|
||||
track = mommy.make('music.Track')
|
||||
track = TrackFactory()
|
||||
|
||||
self.client.login(username=self.user.username, password='test')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue