|
884
|
1 |
""" |
|
|
2 |
This file demonstrates two different styles of tests (one doctest and one |
|
|
3 |
unittest). These will both pass when you run "manage.py test". |
|
|
4 |
|
|
|
5 |
Replace these with more appropriate tests for your application. |
|
|
6 |
""" |
|
|
7 |
|
|
|
8 |
from ldt.test.testcases import OAuthWebTestCase, TestCase |
|
|
9 |
from django.conf import settings |
|
|
10 |
from django.test import TestCase |
|
|
11 |
from ldt.ldt_utils.models import User, Project, Content, Media |
|
|
12 |
from ldt.ldt_utils.utils import LdtUtils, LdtAnnotation, create_ldt, create_empty_iri, copy_ldt |
|
|
13 |
from ldt.test.client import Client |
|
|
14 |
import lxml.etree |
|
|
15 |
import tempfile |
|
|
16 |
import unittest |
|
|
17 |
import uuid |
|
|
18 |
import logging |
|
|
19 |
|
|
|
20 |
class MediaTest(TestCase): |
|
|
21 |
|
|
|
22 |
fixtures = ['base_data.json', 'user_data.json'] |
|
|
23 |
|
|
|
24 |
def setUp(self): |
|
|
25 |
self.client = Client() |
|
|
26 |
User.objects.create_superuser('blop', 'blop@blop.com', 'blop') |
|
|
27 |
|
|
|
28 |
client = self.client.login(username='blop', password='blop') |
|
|
29 |
|
|
|
30 |
self.user = User() |
|
|
31 |
self.user.username = 'blop' |
|
|
32 |
|
|
|
33 |
def test_create_media(self): |
|
|
34 |
self.media1 = Media() |
|
|
35 |
self.media1.id = 1 |
|
|
36 |
self.media1.save() |
|
|
37 |
|
|
|
38 |
self.assertEqual(Media.objects.get(id=self.media1.id), self.media1) |
|
|
39 |
|
|
|
40 |
def test_del_media(self): |
|
|
41 |
self.media2 = Media() |
|
|
42 |
self.media2.id = 2 |
|
|
43 |
self.media2.save() |
|
|
44 |
|
|
|
45 |
self.media2.delete() |
|
|
46 |
|
|
885
|
47 |
self.assertIsNone(Media.objects.get(id=self.media2.id)) |