Changeset 3152 for django/branches/multi-auth/tests
- Timestamp:
- 06/19/06 10:23:57 (2 years ago)
- Files:
-
- django/branches/multi-auth/tests/modeltests/custom_pk/models.py (modified) (1 diff)
- django/branches/multi-auth/tests/modeltests/empty (copied) (copied from django/trunk/tests/modeltests/empty)
- django/branches/multi-auth/tests/modeltests/empty/__init__.py (copied) (copied from django/trunk/tests/modeltests/empty/__init__.py)
- django/branches/multi-auth/tests/modeltests/empty/models.py (copied) (copied from django/trunk/tests/modeltests/empty/models.py)
- django/branches/multi-auth/tests/modeltests/generic_relations (copied) (copied from django/trunk/tests/modeltests/generic_relations)
- django/branches/multi-auth/tests/modeltests/generic_relations/__init__.py (copied) (copied from django/trunk/tests/modeltests/generic_relations/__init__.py)
- django/branches/multi-auth/tests/modeltests/generic_relations/models.py (copied) (copied from django/trunk/tests/modeltests/generic_relations/models.py)
- django/branches/multi-auth/tests/modeltests/get_or_create (copied) (copied from django/trunk/tests/modeltests/get_or_create)
- django/branches/multi-auth/tests/modeltests/get_or_create/__init__.py (copied) (copied from django/trunk/tests/modeltests/get_or_create/__init__.py)
- django/branches/multi-auth/tests/modeltests/get_or_create/models.py (copied) (copied from django/trunk/tests/modeltests/get_or_create/models.py)
- django/branches/multi-auth/tests/modeltests/invalid_models/models.py (modified) (1 diff)
- django/branches/multi-auth/tests/modeltests/properties/models.py (modified) (2 diffs)
- django/branches/multi-auth/tests/othertests/templates.py (modified) (9 diffs)
- django/branches/multi-auth/tests/runtests.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/multi-auth/tests/modeltests/custom_pk/models.py
r3086 r3152 9 9 10 10 class Employee(models.Model): 11 employee_code = models.CharField(maxlength=10, primary_key=True) 11 employee_code = models.CharField(maxlength=10, primary_key=True, 12 db_column = 'code') 12 13 first_name = models.CharField(maxlength=20) 13 14 last_name = models.CharField(maxlength=20) django/branches/multi-auth/tests/modeltests/invalid_models/models.py
r3052 r3152 75 75 invalid_models.fielderrors: "filefield": FileFields require an "upload_to" attribute. 76 76 invalid_models.fielderrors: "prepopulate": prepopulate_from should be a list or tuple. 77 invalid_models.fielderrors: "choices": "choices" should be either a tuple or list.77 invalid_models.fielderrors: "choices": "choices" should be iterable (e.g., a tuple or list). 78 78 invalid_models.fielderrors: "choices2": "choices" should be a sequence of two-tuples. 79 79 invalid_models.fielderrors: "choices2": "choices" should be a sequence of two-tuples. django/branches/multi-auth/tests/modeltests/properties/models.py
r3052 r3152 13 13 def _get_full_name(self): 14 14 return "%s %s" % (self.first_name, self.last_name) 15 16 def _set_full_name(self, combined_name): 17 self.first_name, self.last_name = combined_name.split(' ', 1) 18 15 19 full_name = property(_get_full_name) 20 21 full_name_2 = property(_get_full_name, _set_full_name) 16 22 17 23 API_TESTS = """ … … 26 32 ... 27 33 AttributeError: can't set attribute 34 35 # But "full_name_2" has, and it can be used to initialise the class. 36 >>> a2 = Person(full_name_2 = 'Paul McCartney') 37 >>> a2.save() 38 >>> a2.first_name 39 'Paul' 28 40 """ django/branches/multi-auth/tests/othertests/templates.py
r2965 r3152 170 170 171 171 ### CYCLE TAG ############################################################# 172 #'cycleXX': ('', {}, ''), 173 'cycle01': ('{% cycle a, %}', {}, 'a'), 172 'cycle01': ('{% cycle a %}', {}, template.TemplateSyntaxError), 174 173 'cycle02': ('{% cycle a,b,c as abc %}{% cycle abc %}', {}, 'ab'), 175 174 'cycle03': ('{% cycle a,b,c as abc %}{% cycle abc %}{% cycle abc %}', {}, 'abc'), … … 194 193 195 194 ### FILTER TAG ############################################################ 196 #'filterXX': ('', {}, ''),197 195 'filter01': ('{% filter upper %}{% endfilter %}', {}, ''), 198 196 'filter02': ('{% filter upper %}django{% endfilter %}', {}, 'DJANGO'), … … 200 198 201 199 ### FIRSTOF TAG ########################################################### 202 #'firstofXX': ('', {}, ''),203 200 'firstof01': ('{% firstof a b c %}', {'a':0,'b':0,'c':0}, ''), 204 201 'firstof02': ('{% firstof a b c %}', {'a':1,'b':0,'c':0}, '1'), … … 221 218 'if-tag03': ("{% if foo %}yes{% else %}no{% endif %}", {}, "no"), 222 219 220 # AND 221 'if-tag-and01': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'yes'), 222 'if-tag-and02': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'no'), 223 'if-tag-and03': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'no'), 224 'if-tag-and04': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'no'), 225 'if-tag-and05': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'foo': False}, 'no'), 226 'if-tag-and06': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'bar': False}, 'no'), 227 'if-tag-and07': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'foo': True}, 'no'), 228 'if-tag-and08': ("{% if foo and bar %}yes{% else %}no{% endif %}", {'bar': True}, 'no'), 229 230 # OR 231 'if-tag-or01': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'yes'), 232 'if-tag-or02': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'yes'), 233 'if-tag-or03': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'yes'), 234 'if-tag-or04': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'no'), 235 'if-tag-or05': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'foo': False}, 'no'), 236 'if-tag-or06': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'bar': False}, 'no'), 237 'if-tag-or07': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'foo': True}, 'yes'), 238 'if-tag-or08': ("{% if foo or bar %}yes{% else %}no{% endif %}", {'bar': True}, 'yes'), 239 240 # TODO: multiple ORs 241 242 # NOT 243 'if-tag-not01': ("{% if not foo %}no{% else %}yes{% endif %}", {'foo': True}, 'yes'), 244 'if-tag-not02': ("{% if not %}yes{% else %}no{% endif %}", {'foo': True}, 'no'), 245 'if-tag-not03': ("{% if not %}yes{% else %}no{% endif %}", {'not': True}, 'yes'), 246 'if-tag-not04': ("{% if not not %}no{% else %}yes{% endif %}", {'not': True}, 'yes'), 247 'if-tag-not05': ("{% if not not %}no{% else %}yes{% endif %}", {}, 'no'), 248 249 'if-tag-not06': ("{% if foo and not bar %}yes{% else %}no{% endif %}", {}, 'no'), 250 'if-tag-not07': ("{% if foo and not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'no'), 251 'if-tag-not08': ("{% if foo and not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'yes'), 252 'if-tag-not09': ("{% if foo and not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'no'), 253 'if-tag-not10': ("{% if foo and not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'no'), 254 255 'if-tag-not11': ("{% if not foo and bar %}yes{% else %}no{% endif %}", {}, 'no'), 256 'if-tag-not12': ("{% if not foo and bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'no'), 257 'if-tag-not13': ("{% if not foo and bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'no'), 258 'if-tag-not14': ("{% if not foo and bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'yes'), 259 'if-tag-not15': ("{% if not foo and bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'no'), 260 261 'if-tag-not16': ("{% if foo or not bar %}yes{% else %}no{% endif %}", {}, 'yes'), 262 'if-tag-not17': ("{% if foo or not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'yes'), 263 'if-tag-not18': ("{% if foo or not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'yes'), 264 'if-tag-not19': ("{% if foo or not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'no'), 265 'if-tag-not20': ("{% if foo or not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'yes'), 266 267 'if-tag-not21': ("{% if not foo or bar %}yes{% else %}no{% endif %}", {}, 'yes'), 268 'if-tag-not22': ("{% if not foo or bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'yes'), 269 'if-tag-not23': ("{% if not foo or bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'no'), 270 'if-tag-not24': ("{% if not foo or bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'yes'), 271 'if-tag-not25': ("{% if not foo or bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'yes'), 272 273 'if-tag-not26': ("{% if not foo and not bar %}yes{% else %}no{% endif %}", {}, 'yes'), 274 'if-tag-not27': ("{% if not foo and not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'no'), 275 'if-tag-not28': ("{% if not foo and not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'no'), 276 'if-tag-not29': ("{% if not foo and not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'no'), 277 'if-tag-not30': ("{% if not foo and not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'yes'), 278 279 'if-tag-not31': ("{% if not foo or not bar %}yes{% else %}no{% endif %}", {}, 'yes'), 280 'if-tag-not32': ("{% if not foo or not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': True}, 'no'), 281 'if-tag-not33': ("{% if not foo or not bar %}yes{% else %}no{% endif %}", {'foo': True, 'bar': False}, 'yes'), 282 'if-tag-not34': ("{% if not foo or not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': True}, 'yes'), 283 'if-tag-not35': ("{% if not foo or not bar %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, 'yes'), 284 285 # AND and OR raises a TemplateSyntaxError 286 'if-tag-error01': ("{% if foo or bar and baz %}yes{% else %}no{% endif %}", {'foo': False, 'bar': False}, template.TemplateSyntaxError), 287 'if-tag-error02': ("{% if foo and %}yes{% else %}no{% endif %}", {'foo': True}, template.TemplateSyntaxError), 288 'if-tag-error03': ("{% if foo or %}yes{% else %}no{% endif %}", {'foo': True}, template.TemplateSyntaxError), 289 'if-tag-error04': ("{% if not foo and %}yes{% else %}no{% endif %}", {'foo': True}, template.TemplateSyntaxError), 290 'if-tag-error05': ("{% if not foo or %}yes{% else %}no{% endif %}", {'foo': True}, template.TemplateSyntaxError), 291 223 292 ### IFCHANGED TAG ######################################################### 224 #'ifchangedXX': ('', {}, ''),225 293 'ifchanged01': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% endfor %}', { 'num': (1,2,3) }, '123'), 226 294 'ifchanged02': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% endfor %}', { 'num': (1,1,3) }, '13'), … … 238 306 'ifequal09': ('{% ifequal a "test" %}yes{% else %}no{% endifequal %}', {}, "no"), 239 307 'ifequal10': ('{% ifequal a b %}yes{% else %}no{% endifequal %}', {}, "yes"), 308 309 # SMART SPLITTING 310 'ifequal-split01': ('{% ifequal a "test man" %}yes{% else %}no{% endifequal %}', {}, "no"), 311 'ifequal-split02': ('{% ifequal a "test man" %}yes{% else %}no{% endifequal %}', {'a': 'foo'}, "no"), 312 'ifequal-split03': ('{% ifequal a "test man" %}yes{% else %}no{% endifequal %}', {'a': 'test man'}, "yes"), 313 'ifequal-split04': ("{% ifequal a 'test man' %}yes{% else %}no{% endifequal %}", {'a': 'test man'}, "yes"), 314 'ifequal-split05': ("{% ifequal a 'i \"love\" you' %}yes{% else %}no{% endifequal %}", {'a': ''}, "no"), 315 'ifequal-split06': ("{% ifequal a 'i \"love\" you' %}yes{% else %}no{% endifequal %}", {'a': 'i "love" you'}, "yes"), 316 'ifequal-split07': ("{% ifequal a 'i \"love\" you' %}yes{% else %}no{% endifequal %}", {'a': 'i love you'}, "no"), 317 'ifequal-split08': (r"{% ifequal a 'I\'m happy' %}yes{% else %}no{% endifequal %}", {'a': "I'm happy"}, "yes"), 318 'ifequal-split09': (r"{% ifequal a 'slash\man' %}yes{% else %}no{% endifequal %}", {'a': r"slash\man"}, "yes"), 319 'ifequal-split10': (r"{% ifequal a 'slash\man' %}yes{% else %}no{% endifequal %}", {'a': r"slashman"}, "no"), 240 320 241 321 ### IFNOTEQUAL TAG ######################################################## … … 389 469 390 470 ### REGROUP TAG ########################################################### 391 #'regroupXX': ('', {}, ''),392 471 'regroup01': ('{% regroup data by bar as grouped %}' + \ 393 472 '{% for group in grouped %}' + \ … … 415 494 416 495 ### TEMPLATETAG TAG ####################################################### 417 #'templatetagXX': ('', {}, ''),418 496 'templatetag01': ('{% templatetag openblock %}', {}, '{%'), 419 497 'templatetag02': ('{% templatetag closeblock %}', {}, '%}'), … … 422 500 'templatetag05': ('{% templatetag %}', {}, template.TemplateSyntaxError), 423 501 'templatetag06': ('{% templatetag foo %}', {}, template.TemplateSyntaxError), 502 'templatetag07': ('{% templatetag openbrace %}', {}, '{'), 503 'templatetag08': ('{% templatetag closebrace %}', {}, '}'), 504 'templatetag09': ('{% templatetag openbrace %}{% templatetag openbrace %}', {}, '{{'), 505 'templatetag10': ('{% templatetag closebrace %}{% templatetag closebrace %}', {}, '}}'), 424 506 425 507 ### WIDTHRATIO TAG ######################################################## 426 #'widthratioXX': ('', {}, ''),427 508 'widthratio01': ('{% widthratio a b 0 %}', {'a':50,'b':100}, '0'), 428 509 'widthratio02': ('{% widthratio a b 100 %}', {'a':0,'b':0}, ''), … … 441 522 'widthratio09': ('{% widthratio a b %}', {'a':50,'b':100}, template.TemplateSyntaxError), 442 523 'widthratio10': ('{% widthratio a b 100.0 %}', {'a':50,'b':100}, template.TemplateSyntaxError), 443 524 444 525 ### NOW TAG ######################################################## 445 526 # Simple case 446 527 'now01' : ('{% now "j n Y"%}', {}, str(datetime.now().day) + ' ' + str(datetime.now().month) + ' ' + str(datetime.now().year)), 447 528 448 529 # Check parsing of escaped and special characters 449 530 'now02' : ('{% now "j "n" Y"%}', {}, template.TemplateSyntaxError), django/branches/multi-auth/tests/runtests.py
r2998 r3152 22 22 23 23 ALWAYS_INSTALLED_APPS = [ 24 'django.contrib. admin',24 'django.contrib.contenttypes', 25 25 'django.contrib.auth', 26 'django.contrib.comments', 27 'django.contrib.contenttypes', 26 'django.contrib.sites', 28 27 'django.contrib.flatpages', 29 28 'django.contrib.redirects', 30 29 'django.contrib.sessions', 31 'django.contrib.sites', 30 'django.contrib.comments', 31 'django.contrib.admin', 32 32 ] 33 33 … … 149 149 # Initialize the test database. 150 150 cursor = connection.cursor() 151 152 # Install the core always installed apps 153 for app in ALWAYS_INSTALLED_APPS: 154 self.output(1, "Installing contrib app %s" % app) 155 mod = __import__(app + ".models", '', '', ['']) 156 management.install(mod) 151 157 152 158 # Run the tests for each test model.
