def test_tags_manager(self): """Make sure the TaggableManager exists. Full testing of functionality is a matter for taggit's tests. """ tags_eq(self.untagged_question, [])
def test_auto_tagging_aurora(self): """Make sure versions with prerelease suffix are tagged properly.""" q = self.question q.add_metadata(ff_version='18.0a2') q.save() q.auto_tag() tags_eq(q, ['Firefox 18.0'])
def test_auto_tagging_restraint(self): """Auto-tagging shouldn't tag unknown Firefox versions or OSes.""" q = self.question q.add_metadata(ff_version='allyourbase', os='toaster 1.0') q.save() q.auto_tag() tags_eq(q, [])
def test_auto_tagging_restraint(self): """Auto-tagging shouldn't tag unknown Firefox versions or OSes.""" q = self.question q.add_metadata(ff_version="allyourbase", os="toaster 1.0") q.save() q.auto_tag() tags_eq(q, [])
def test_auto_tagging_aurora(self): """Make sure versions with prerelease suffix are tagged properly.""" q = self.question q.add_metadata(ff_version="18.0a2") q.save() q.auto_tag() tags_eq(q, ["Firefox 18.0"])
def test_auto_tagging(self): """Make sure tags get applied based on metadata on first save.""" Tag.objects.create(slug='green', name='green') Tag.objects.create(slug='Fix problems', name='fix-problems') q = self.question q.add_metadata(product='desktop', category='fix-problems', ff_version='3.6.8', os='GREen') q.save() q.auto_tag() tags_eq(q, ['desktop', 'fix-problems', 'Firefox 3.6.8', 'Firefox 3.6', 'green'])
def test_auto_tagging(self): """Make sure tags get applied based on metadata on first save.""" Tag.objects.create(slug="green", name="green") Tag.objects.create(slug="Fix problems", name="fix-problems") q = self.question q.add_metadata( product="desktop", category="fix-problems", ff_version="3.6.8", os="GREen" ) q.save() q.auto_tag() tags_eq(q, ["desktop", "fix-problems", "Firefox 3.6.8", "Firefox 3.6", "green"])
def test_auto_tagging(self): """Test that questions created via the API are auto-tagged.""" TagFactory(name='desktop') q = QuestionFactory() self.client.force_authenticate(user=q.creator) tags_eq(q, []) res = self.client.post( reverse('question-set-metadata', args=[q.id]), content_type='application/json', data=json.dumps({'name': 'product', 'value': 'desktop'})) eq_(res.status_code, 200) tags_eq(q, []) res = self.client.post( reverse('question-auto-tag', args=[q.id]), content_type='application/json') eq_(res.status_code, 204) tags_eq(q, ['desktop'])
def test_auto_tagging(self): """Test that questions created via the API are auto-tagged.""" TagFactory(name="desktop") q = QuestionFactory() self.client.force_authenticate(user=q.creator) tags_eq(q, []) res = self.client.post( reverse("question-set-metadata", args=[q.id]), content_type="application/json", data=json.dumps({ "name": "product", "value": "desktop" }), ) eq_(res.status_code, 200) tags_eq(q, []) res = self.client.post(reverse("question-auto-tag", args=[q.id]), content_type="application/json") eq_(res.status_code, 204) tags_eq(q, ["desktop"])
def test_add_existing_case_insensitive(self): """Assert add_existing_tag works case-insensitively.""" tag(name='lemon', slug='lemon', save=True) add_existing_tag('LEMON', self.untagged_question.tags) tags_eq(self.untagged_question, [u'lemon'])
def test_add_existing_case_insensitive(self): """Assert add_existing_tag works case-insensitively.""" TagFactory(name='lemon', slug='lemon') add_existing_tag('LEMON', self.untagged_question.tags) tags_eq(self.untagged_question, ['lemon'])
def test_add_existing_case_insensitive(self): """Assert add_existing_tag works case-insensitively.""" TagFactory(name="lemon", slug="lemon") add_existing_tag("LEMON", self.untagged_question.tags) tags_eq(self.untagged_question, [u"lemon"])