From 38c039a684a03191433a27dcf4a82808cd4eaade Mon Sep 17 00:00:00 2001 From: Nick Sergeant Date: Sun, 24 Mar 2013 17:21:04 -0400 Subject: [PATCH] Starting work on API test suite and removing reference to Site object. --- accounts/tests.py | 16 ---------------- blogs/tests.py | 16 ---------------- snipts/models.py | 5 +---- snipts/tests.py | 13 +++---------- utils/tests.py | 16 ---------------- 5 files changed, 4 insertions(+), 62 deletions(-) delete mode 100644 accounts/tests.py delete mode 100644 blogs/tests.py delete mode 100644 utils/tests.py diff --git a/accounts/tests.py b/accounts/tests.py deleted file mode 100644 index 501deb7..0000000 --- a/accounts/tests.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -This file demonstrates writing tests using the unittest module. These will pass -when you run "manage.py test". - -Replace this with more appropriate tests for your application. -""" - -from django.test import TestCase - - -class SimpleTest(TestCase): - def test_basic_addition(self): - """ - Tests that 1 + 1 always equals 2. - """ - self.assertEqual(1 + 1, 2) diff --git a/blogs/tests.py b/blogs/tests.py deleted file mode 100644 index 501deb7..0000000 --- a/blogs/tests.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -This file demonstrates writing tests using the unittest module. These will pass -when you run "manage.py test". - -Replace this with more appropriate tests for your application. -""" - -from django.test import TestCase - - -class SimpleTest(TestCase): - def test_basic_addition(self): - """ - Tests that 1 + 1 always equals 2. - """ - self.assertEqual(1 + 1, 2) diff --git a/snipts/models.py b/snipts/models.py index b683c9f..d8e41ce 100644 --- a/snipts/models.py +++ b/snipts/models.py @@ -1,4 +1,3 @@ -from django.contrib.sites.models import Site from django.contrib.auth.models import User from django.conf import settings from django.db import models @@ -16,8 +15,6 @@ from snipts.utils import slugify_uniquely import datetime, md5, random, re -site = Site.objects.all()[0] - class Snipt(models.Model): """An individual Snipt.""" @@ -165,7 +162,7 @@ class Snipt(models.Model): else: root = 'https://snipt.net' - return 'https://{}/embed/{}/'.format(site.domain, self.key) + return 'https://{}/embed/{}/'.format(root, self.key) def get_raw_url(self): diff --git a/snipts/tests.py b/snipts/tests.py index 501deb7..96915a8 100644 --- a/snipts/tests.py +++ b/snipts/tests.py @@ -1,16 +1,9 @@ -""" -This file demonstrates writing tests using the unittest module. These will pass -when you run "manage.py test". - -Replace this with more appropriate tests for your application. -""" - from django.test import TestCase -class SimpleTest(TestCase): - def test_basic_addition(self): +class SniptAPITest(TestCase): + def test_get_snipt(self): """ - Tests that 1 + 1 always equals 2. + We should be able to get a public snipt from the API. """ self.assertEqual(1 + 1, 2) diff --git a/utils/tests.py b/utils/tests.py deleted file mode 100644 index 501deb7..0000000 --- a/utils/tests.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -This file demonstrates writing tests using the unittest module. These will pass -when you run "manage.py test". - -Replace this with more appropriate tests for your application. -""" - -from django.test import TestCase - - -class SimpleTest(TestCase): - def test_basic_addition(self): - """ - Tests that 1 + 1 always equals 2. - """ - self.assertEqual(1 + 1, 2)