とりあえず

何かをヤッてみる、という事で clone を別な場所に。

$ mkdir tmp
$ cd tmp
$ git clone git clone git://github.com/yamanetoshi/rss.git
Initialized empty Git repository in /home/guest/tmp/rss/.git/
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 9 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (9/9), done.
$ cd rss
$

で、settings.py に以下を盛り込んで

DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = 'rss.db'

syncdb

$ python manage.py syncdb
Creating table auth_message
Creating table auth_group
Creating table auth_user
Creating table auth_permission
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table feedjack_feed
Creating table feedjack_site
Creating table feedjack_subscriber
Creating table feedjack_tag
Creating table feedjack_link
Creating table feedjack_post

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (Leave blank to use 'guest'): admin
E-mail address: xxx@yyy.com
Password: 
Password (again): 
Superuser created successfully.
Installing index for auth.Message model
Installing index for auth.Permission model
Installing index for feedjack.Subscriber model
Installing index for feedjack.Post model
$

これって settings.py は ignore なソレをナニしとくべきなのでしょうか。あ、上記で作成した rss.db も同様か。
あるいは *~ とか *.pyc とかも、になるのかなぁ。

model なソレ

試験を作ってみたい、と言いつつ以下を試してみた。

$ python manage.py shell
Python 2.4.4 (#2, Apr  5 2007, 20:11:18)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from feedjack import Link
Traceback (most recent call last):
  File "<console>", line 1, in ?
ImportError: cannot import name Link

む。駄目か。こうすれば良いの??

>>> from feedjack.models import Link
>>> Link.objects.all()
[]
>>> 

を、イケた。なるほどなるほど。で、Djangoアプリケーションのテストを見つつ試験をでっち上げてみたいのですが、save とか fixture 作らないとナニ、とか

    link = models.URLField(_('link'), verify_exists=True)

な列の verify_exists の試験とかどうするのか、と。それは良いのですが、ここでエントリ投入には中途ハンパ杉だなぁ。

リクエストとレスポンス

うーん。test.py 書いてみた。

import unittest
from django.test.client import Client

class SimpleTest(unittest.TestCase):
    def setUp(self):
        self.client = Client()

    def test_details(self):
        response = self.client.get('/')

        self.failUnlessEqual(response.status_code, 200)

ちなみに urls.py を以下にナニ

from django.conf.urls.defaults import *

urlpatterns = patterns('',
    # Example:
    # (r'^rss/', include('rss.foo.urls')),
      (r'^$', include('feedjack.urls')),
    # Uncomment this for admin:
#     (r'^admin/', include('django.contrib.admin.urls')),
)

試験にパスしているみたいに見えるんですが絶対嘘だ。以下を追加してみたんですが、

        self.failUnlessEqual(response.template.name, "")

# ぜったいパスしねぇ。
結果は以下

...
----------------------------------------------------------------------
Ran 3 tests in 0.046s

OK

むむむ。こんな微妙なレベルで gdgd してる割には時間が取れなくって、こんな事してる場合じゃないんですが。

とりあえずは

書いた試験がきちんと動いてるのを見たい。あるいは何が微妙なのか、が知りたい。