tests.py 1.79 KB
Newer Older
Stauros Kroustouris's avatar
Stauros Kroustouris committed
1 2
from django.test import TestCase
from django.test import Client
Stauros Kroustouris's avatar
Stauros Kroustouris committed
3

Stauros Kroustouris's avatar
Stauros Kroustouris committed
4
from django.core.urlresolvers import reverse
Stauros Kroustouris's avatar
Stauros Kroustouris committed
5 6


Stauros Kroustouris's avatar
Stauros Kroustouris committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
class ApiTest(TestCase):
    def setUp(self):
        self.client = Client()

    def test_api_urls(self):
        '''
        Check if api urls exist
        '''
        response = self.client.get(reverse('api:pops'))
        self.assertEqual(response.status_code, 200)

    def test_import_models(self):
        '''
        Check if needed models exist
        '''
        from network.models import PeerIfces, PeerSite
Stauros Kroustouris's avatar
Stauros Kroustouris committed
23

Stauros Kroustouris's avatar
Stauros Kroustouris committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
    def test_static(self):
        '''
        Check if static files exist
        '''
        from django.contrib.staticfiles import finders
        self.assertIsNot(finders.find('pops/icons/customer-legend.png'), None)
        self.assertIsNot(finders.find('pops/icons/grnet-legend.png'), None)
        self.assertIsNot(finders.find('pops/icons/commercial-legend.png'), None)
        self.assertIsNot(finders.find('pops/icons/pin-legend.png'), None)
        self.assertIsNot(finders.find('pops/icons/core-legend.png'), None)
        self.assertIsNot(finders.find('pops/icons/access-optical-legend.png'), None)
        self.assertIsNot(finders.find('pops/icons/access-l2-legend.png'), None)
        self.assertIsNot(finders.find('pops/icons/distribution-legend.png'), None)
        self.assertIsNot(finders.find('pops/icons/pass-through-thumb.png'), None)
        self.assertIsNot(finders.find('pops/icons/unknown-thumb.png'), None)
        self.assertIsNot(finders.find('bootstrap/js/bootstrap.js'), None)
        self.assertIsNot(finders.find('pops/js/gmaps.js'), None)
        self.assertIsNot(finders.find('pops/js/underscore-min.js'), None)
        self.assertIsNot(finders.find('bootstrap/css/bootstrap.min.css'), None)
        self.assertIsNot(finders.find('pops/css/maps.css'), None)