-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nicolas Kuttler
committed
Feb 28, 2012
1 parent
ea180a0
commit 520e59a
Showing
13 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
build | ||
dist | ||
*.egg-info | ||
django-webmaster-verification-test-project/db.sqlite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
test: | ||
make -C django-webmaster-verification-test-project test | ||
|
||
install: | ||
python setup.py install | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
db.sqlite: | ||
python manage.py syncdb --noinput | ||
|
||
.PHONY: test | ||
test: db.sqlite | ||
PYTHONPATH=.. python manage.py test test_app |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env python | ||
from django.core.management import execute_manager | ||
import imp | ||
try: | ||
imp.find_module('settings') # Assumed to be in the same directory. | ||
except ImportError: | ||
import sys | ||
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__) | ||
sys.exit(1) | ||
|
||
import settings | ||
|
||
if __name__ == "__main__": | ||
execute_manager(settings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
DEBUG = True | ||
TEMPLATE_DEBUG = True | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': 'db.sqlite', | ||
} | ||
} | ||
|
||
ROOT_URLCONF = 'urls' | ||
|
||
INSTALLED_APPS = ( | ||
'webmaster_verification', | ||
'test_app', | ||
) | ||
|
||
WEBMASTER_VERIFICATION = { | ||
'google': 'ffffffffffffffff', | ||
'bing': 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', | ||
'majestic': 'ffffffffffffffffffffffffffffffff', | ||
} |
Empty file.
3 changes: 3 additions & 0 deletions
3
django-webmaster-verification-test-project/test_app/models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.db import models | ||
|
||
# Create your models here. |
1 change: 1 addition & 0 deletions
1
django-webmaster-verification-test-project/test_app/templates/robots_txt/robots.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
It works! |
Empty file.
51 changes: 51 additions & 0 deletions
51
django-webmaster-verification-test-project/test_app/tests.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from django.core.urlresolvers import reverse | ||
from django.test import TestCase | ||
from django.test.client import Client | ||
|
||
class WebmasterVerificationTest(TestCase): | ||
def setUp(self): | ||
self.client = Client() | ||
|
||
def test_google_file_access(self): | ||
url = '/googleffffffffffffffff.html' | ||
r = self.client.get(url) | ||
self.assertEqual( | ||
r.status_code, | ||
200, | ||
"Couldn't access %s, got %d" % (url, r.status_code) | ||
) | ||
|
||
def test_bing_file_access(self): | ||
url = '/BingSiteAuth.xml' | ||
r = self.client.get(url) | ||
self.assertEqual( | ||
r.status_code, | ||
200, | ||
"Couldn't access %s, got %d" % (url, r.status_code) | ||
) | ||
self.assertEqual( | ||
r['Content-Type'], | ||
'text/xml', | ||
"Got %s content type for robots.txt" % r['Content-Type'] | ||
) | ||
|
||
def test_mj_file_access(self): | ||
url = '/MJ12_FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.txt' | ||
r = self.client.get(url) | ||
self.assertEqual( | ||
r.status_code, | ||
200, | ||
"Couldn't access %s, got %d" % (url, r.status_code) | ||
) | ||
self.assertEqual( | ||
r['Content-Type'], | ||
'text/plain', | ||
"Got %s content type for robots.txt" % r['Content-Type'] | ||
) | ||
|
||
#def test_robotstxt_has_text_plain_content_type(self): | ||
# url = '/robots.txt' | ||
# r = self.client.get(url) | ||
#url = ( | ||
# '/BingSiteAuth.xml', | ||
#) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Create your views here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.conf.urls.defaults import patterns, include, url | ||
|
||
from django.views.generic import TemplateView | ||
from webmaster_verification.views import BingVerificationView | ||
|
||
urlpatterns = patterns('', | ||
url(r'^x$', TemplateView.as_view(template_name = 'x')), | ||
url(r'', include('webmaster_verification.urls')), | ||
) |