author | Pawel Solyga <Pawel.Solyga@gmail.com> |
Mon, 01 Jun 2009 22:17:38 +0200 | |
changeset 2375 | b9b203dc96d8 |
parent 2368 | e07c425c7135 |
permissions | -rw-r--r-- |
2368
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/env python |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
2 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
3 |
#Copyright 2008 Adam A. Crossland |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
4 |
# |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
5 |
#Licensed under the Apache License, Version 2.0 (the "License"); |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
6 |
#you may not use this file except in compliance with the License. |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
7 |
#You may obtain a copy of the License at |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
8 |
# |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
9 |
#http://www.apache.org/licenses/LICENSE-2.0 |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
10 |
# |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
11 |
#Unless required by applicable law or agreed to in writing, software |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
12 |
#distributed under the License is distributed on an "AS IS" BASIS, |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
13 |
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
14 |
#See the License for the specific language governing permissions and |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
15 |
#limitations under the License. |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
16 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
17 |
import sys |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
18 |
import os.path |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
19 |
|
2375
b9b203dc96d8
Make taggable-mixin tests working by updating GAE path.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
2368
diff
changeset
|
20 |
APPENGINE_PATH = '../../thirdparty/google_appengine' |
2368
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
21 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
22 |
# Add app-engine related libraries to your path |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
23 |
paths = [ |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
24 |
APPENGINE_PATH, |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
25 |
os.path.join(APPENGINE_PATH, 'lib', 'django'), |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
26 |
os.path.join(APPENGINE_PATH, 'lib', 'webob'), |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
27 |
os.path.join(APPENGINE_PATH, 'lib', 'yaml', 'lib') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
28 |
] |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
29 |
for path in paths: |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
30 |
if not os.path.exists(path): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
31 |
raise 'Path does not exist: %s' % path |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
32 |
sys.path = paths + sys.path |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
33 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
34 |
import unittest |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
35 |
from google.appengine.api import apiproxy_stub_map |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
36 |
from google.appengine.api import datastore_file_stub |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
37 |
from google.appengine.api import mail_stub |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
38 |
from google.appengine.api import user_service_stub |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
39 |
from google.appengine.ext import webapp |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
40 |
from google.appengine.ext import db |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
41 |
from google.appengine.api.memcache import memcache_stub |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
42 |
from taggable import * |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
43 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
44 |
APP_ID = u'taggable' |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
45 |
AUTH_DOMAIN = 'gmail.com' |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
46 |
LOGGED_IN_USER = 'me@example.com' # set to '' for no logged in user |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
47 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
48 |
BLOG_NAME='test_blog' |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
49 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
50 |
class BlogIndex(db.Model): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
51 |
"A global counter used to provide the index of the next blog post." |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
52 |
index = db.IntegerProperty(required=True, default=0) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
53 |
"The next available index for a Post." |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
54 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
55 |
class Post(Taggable, db.Model): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
56 |
index = db.IntegerProperty(required=True, default=0) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
57 |
body = db.TextProperty(required = True) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
58 |
title = db.StringProperty() |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
59 |
added = db.DateTimeProperty(auto_now_add=True) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
60 |
added_month = db.IntegerProperty() |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
61 |
added_year = db.IntegerProperty() |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
62 |
edited = db.DateTimeProperty() |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
63 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
64 |
def __init__(self, parent=None, key_name=None, app=None, **entity_values): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
65 |
db.Model.__init__(self, parent, key_name, app, **entity_values) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
66 |
Taggable.__init__(self) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
67 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
68 |
def get_all_posts(): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
69 |
return db.GqlQuery("SELECT * from Post ORDER BY added DESC") |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
70 |
Get_All_Posts = staticmethod(get_all_posts) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
71 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
72 |
@classmethod |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
73 |
def get_posts(cls, start_index=0, count=10): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
74 |
start_index = int(start_index) # Just make sure that we have an int |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
75 |
posts = Post.gql('WHERE index <= :1 ORDER BY index DESC', start_index).fetch(count + 1) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
76 |
if len(posts) > count: |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
77 |
posts = posts[:count] |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
78 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
79 |
return posts |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
80 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
81 |
@classmethod |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
82 |
def new_post(cls, new_title=None, new_body=None, new_tags=[]): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
83 |
new_post = None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
84 |
if new_title is not None and new_body is not None: |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
85 |
def txn(): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
86 |
blog_index = BlogIndex.get_by_key_name(BLOG_NAME) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
87 |
if blog_index is None: |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
88 |
blog_index = BlogIndex(key_name=BLOG_NAME) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
89 |
new_index = blog_index.index |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
90 |
blog_index.index += 1 |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
91 |
blog_index.put() |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
92 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
93 |
new_post_key_name = BLOG_NAME + str(new_index) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
94 |
new_post = Post(key_name=new_post_key_name, parent=blog_index, |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
95 |
index = new_index, title = new_title, |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
96 |
body = new_body) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
97 |
new_post.put() |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
98 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
99 |
return new_post |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
100 |
new_post = db.run_in_transaction(txn) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
101 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
102 |
new_post.tags = new_tags |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
103 |
new_post.put() |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
104 |
else: |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
105 |
raise Exception("Must supply both new_title and new_body when creating a new Post.") |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
106 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
107 |
return new_post |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
108 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
109 |
def delete(self): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
110 |
# Perform any actions that are required to maintain data integrity |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
111 |
# when this Post is delete. |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
112 |
# Disassociate this Post from any Tag |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
113 |
self.set_tags([]) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
114 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
115 |
# Finally, call the real delete |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
116 |
db.Model.delete(self) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
117 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
118 |
class MyTest(unittest.TestCase): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
119 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
120 |
def setUp(self): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
121 |
# Start with a fresh api proxy. |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
122 |
apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap() |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
123 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
124 |
# Use a fresh stub datastore. |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
125 |
stub = datastore_file_stub.DatastoreFileStub(APP_ID, '/dev/null', '/dev/null') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
126 |
apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', stub) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
127 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
128 |
# Use a fresh memcache stub. |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
129 |
apiproxy_stub_map.apiproxy.RegisterStub('memcache', memcache_stub.MemcacheServiceStub()) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
130 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
131 |
# Use a fresh stub UserService. |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
132 |
apiproxy_stub_map.apiproxy.RegisterStub( |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
133 |
'user', user_service_stub.UserServiceStub()) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
134 |
os.environ['AUTH_DOMAIN'] = AUTH_DOMAIN |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
135 |
os.environ['USER_EMAIL'] = LOGGED_IN_USER |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
136 |
os.environ['APPLICATION_ID'] = APP_ID |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
137 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
138 |
def testSimpleTagAdding(self): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
139 |
new_post = Post.new_post(new_title='test post 1', new_body='This is a test post. Please ignore.') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
140 |
assert new_post is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
141 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
142 |
new_post.tags = "test, testing, tests" |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
143 |
self.assertEqual(len(new_post.tags), 3) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
144 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
145 |
def testComplexTagAdding(self): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
146 |
new_post = Post.new_post(new_title='test post 1', new_body='This is a test post. Please ignore.') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
147 |
assert new_post is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
148 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
149 |
new_post.tags = " test, testing, tests,,,tag with spaces" |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
150 |
self.assertEqual(len(new_post.tags), 4) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
151 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
152 |
tag = new_post.tags[3] |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
153 |
assert tag is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
154 |
self.assertEqual(tag.tag, 'tag with spaces') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
155 |
self.assertEqual(tag.tagged_count, 1) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
156 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
157 |
tag2 = Tag.get_by_name('tag with spaces') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
158 |
assert tag2 is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
159 |
self.assertEqual(tag.tag, 'tag with spaces') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
160 |
self.assertEqual(tag.tagged_count, 1) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
161 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
162 |
def testTagDeletion(self): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
163 |
new_post = Post.new_post(new_title='test post 2', new_body='This is a test post. Please continue to ignore.') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
164 |
assert new_post is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
165 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
166 |
new_post.tags = "test, testing, tests" |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
167 |
self.assertEqual(len(new_post.tags), 3) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
168 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
169 |
new_post.tags = "test" |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
170 |
self.assertEqual(len(new_post.tags), 1) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
171 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
172 |
def testTagCounts(self): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
173 |
new_post3 = Post.new_post(new_title='test post 3', new_body='This is a test post. Please continue to ignore.') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
174 |
assert new_post3 is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
175 |
new_post3.tags = "foo, bar, baz" |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
176 |
new_post4 = Post.new_post(new_title='test post 4', new_body='This is a test post. Please continue to ignore.') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
177 |
assert new_post4 is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
178 |
new_post4.tags = "bar, baz, bletch" |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
179 |
new_post5 = Post.new_post(new_title='test post 5', new_body='This is a test post. Please continue to ignore.') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
180 |
assert new_post5 is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
181 |
new_post5.tags = "baz, bletch, quux" |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
182 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
183 |
foo_tag = Tag.get_by_name('foo') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
184 |
assert foo_tag is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
185 |
self.assertEqual(foo_tag.tagged_count, 1) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
186 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
187 |
bar_tag = Tag.get_by_name('bar') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
188 |
assert bar_tag is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
189 |
self.assertEqual(bar_tag.tagged_count, 2) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
190 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
191 |
baz_tag = Tag.get_by_name('baz') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
192 |
assert baz_tag is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
193 |
self.assertEqual(baz_tag.tagged_count, 3) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
194 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
195 |
bletch_tag = Tag.get_by_name('bletch') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
196 |
assert bletch_tag is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
197 |
self.assertEqual(bletch_tag.tagged_count, 2) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
198 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
199 |
quux_tag = Tag.get_by_name('quux') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
200 |
assert quux_tag is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
201 |
self.assertEqual(quux_tag.tagged_count, 1) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
202 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
203 |
new_post3.tags = 'bar, baz' |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
204 |
foo_tag = Tag.get_by_name('foo') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
205 |
assert foo_tag is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
206 |
self.assertEqual(len(new_post3.tags), 2) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
207 |
self.assertEqual(foo_tag.tagged_count, 0) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
208 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
209 |
def testTagGetTagsForKey(self): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
210 |
new_post = Post.new_post(new_title='test post 6', new_body='This is a test post. Please continue to ignore.', new_tags='foo,bar,bletch,quux') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
211 |
assert new_post is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
212 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
213 |
tags = Tag.get_tags_for_key(new_post.key()) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
214 |
assert tags is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
215 |
self.assertEqual(type(tags), type([])) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
216 |
self.assertEqual(len(tags), 4) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
217 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
218 |
def testTagGetByName(self): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
219 |
new_post = Post.new_post(new_title='test post 6', new_body='This is a test post. Please continue to ignore.', new_tags='foo,bar,bletch,quux') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
220 |
assert new_post is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
221 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
222 |
quux_tag = Tag.get_by_name('quux') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
223 |
assert quux_tag is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
224 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
225 |
zizzle_tag = Tag.get_by_name('zizzle') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
226 |
assert zizzle_tag is None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
227 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
228 |
def testTagsString(self): |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
229 |
new_post = Post.new_post(new_title='test post 6', new_body='This is a test post. Please continue to ignore.', new_tags=' pal,poll ,,pip,pony') |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
230 |
assert new_post is not None |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
231 |
self.assertEqual(new_post.tags_string(), "pal,poll,pip,pony") |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
232 |
new_post.tag_separator = "|" |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
233 |
self.assertEqual(new_post.tags_string(), "pal|poll|pip|pony") |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
234 |
new_post.tag_separator = " , " |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
235 |
self.assertEqual(new_post.tags_string(), "pal , poll , pip , pony") |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
236 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
237 |
new_post.tag_separator = ", " |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
238 |
new_post.tags = "pal, pill, pip" |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
239 |
self.assertEqual(len(new_post.tags), 3) |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
240 |
self.assertEqual(new_post.tags_string(), "pal, pill, pip") |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
241 |
|
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
242 |
if __name__ == '__main__': |
e07c425c7135
Add taggable-mixin to Melange repository.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
243 |
unittest.main() |