def test_09_tag(self): self.test_04_edit_page() tag = Tag() tag.page = u'wiki-test-hehe/Pagé' tag.tag = 'test' tag.save() response = self.client.get('/tag/test') self.assertEqual(response.status_code, 200)
def add_tag(self, slug=None, path=None, tag=None): dajax = Dajax() if not slug or not path or not tag: return dajax.json() t = Tag() t.page = os.path.join(slug, path) t.tag = tag t.save() tmpl = Template(TEMPLATE_TAG) ctx = Context({'tag': t}) dajax.append('#tags', 'innerHTML', tmpl.render(ctx)) return dajax.json()
def test_01_create(self): """ Create a tag """ # Create t = Tag() t.page = 'test/Test' t.tag = 'test' t.save() # Make sure it's here c = Tag.objects.count() self.assertEqual(c, 1) # Make sure it's the good one tags = Tag.objects.filter(page='test/Test') self.assertNotEqual(tags, Tag.objects.none()) self.assertEqual(tags.count(), 1) self.assertEqual(tags[0].tag, 'test') self.assertEqual(tags[0].page, 'test/Test')