Esempio n. 1
0
 def test_add_new_case_insensitive(self):
     """Adding a tag differing only in case from existing ones shouldn't
     create a new tag."""
     self.client.post(_add_async_tag_url(),
                      data={'tag-name': 'RED'},
                      HTTP_X_REQUESTED_WITH='XMLHttpRequest')
     tags_eq(Question.objects.get(pk=1), ['red'])
Esempio n. 2
0
 def test_add_async_new_tag(self):
     """Assert adding an nonexistent tag creates & adds it."""
     response = self.client.post(_add_async_tag_url(),
                                 data={'tag-name': 'nonexistent tag'},
                                 HTTP_X_REQUESTED_WITH='XMLHttpRequest')
     eq_(response.status_code, 200)
     tags_eq(Question.objects.get(pk=1), ['nonexistent tag'])
Esempio n. 3
0
    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, [])
Esempio n. 4
0
    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, [])
Esempio n. 5
0
 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'])
Esempio n. 6
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, [])
Esempio n. 7
0
 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'])
Esempio n. 8
0
 def test_add_async_new_tag(self):
     """Assert adding an nonexistent tag creates & adds it."""
     response = self.client.post(_add_async_tag_url(),
                                 data={'tag-name': 'nonexistent tag'},
                                 HTTP_X_REQUESTED_WITH='XMLHttpRequest')
     eq_(response.status_code, 200)
     tags_eq(Question.objects.get(pk=1), ['nonexistent tag'])
Esempio n. 9
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, [])
Esempio n. 10
0
 def test_auto_tagging(self):
     """Make sure tags get applied based on metadata on first save."""
     Tag.objects.create(slug='green', name='green')
     q = self.question
     q.add_metadata(product='desktop', category='d1', ff_version='3.6.8',
                    os='GREen')
     q.save()
     q.auto_tag()
     tags_eq(q, ['desktop', 'websites', 'Firefox 3.6.8', 'Firefox 3.6',
                 'green'])
Esempio n. 11
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'])
Esempio n. 12
0
 def test_changing_products(self):
     """Changing products works as expected."""
     d, r = doc_rev()
     data = new_document_data()
     data.update({'products': ['desktop', 'sync'], 'form': 'doc'})
     self.client.post(reverse('wiki.edit_document', args=[d.slug]), data)
     tags_eq(d, ['desktop', 'sync'])
     data.update({'products': ['mobile'], 'form': 'doc'})
     self.client.post(reverse('wiki.edit_document', args=[data['slug']]),
                      data)
     tags_eq(d, ['mobile'])
Esempio n. 13
0
 def test_changing_products(self):
     """Changing products works as expected."""
     d, r = doc_rev()
     data = new_document_data()
     data.update({'products': ['desktop', 'sync'],
                  'form': 'doc'})
     self.client.post(reverse('wiki.edit_document', args=[d.slug]), data)
     tags_eq(d, ['desktop', 'sync'])
     data.update({'products': ['mobile'],
                  'form': 'doc'})
     self.client.post(reverse('wiki.edit_document', args=[data['slug']]),
                      data)
     tags_eq(d, ['mobile'])
Esempio n. 14
0
 def test_changing_products(self):
     """Changing products works as expected."""
     client = LocalizingClient()
     client.login(username='******', password='******')
     d, r = doc_rev()
     data = new_document_data()
     data.update({'products': ['desktop', 'sync'],
                  'form': 'doc'})
     client.post(reverse('wiki.edit_document', args=[d.slug]), data)
     tags_eq(d, ['desktop', 'sync'])
     data.update({'products': ['mobile'],
                  'form': 'doc'})
     client.post(reverse('wiki.edit_document', args=[data['slug']]), data)
     tags_eq(d, ['mobile'])
Esempio n. 15
0
 def test_add_existing_case_insensitive(self):
     """Assert add_existing_tag works case-insensitively."""
     add_existing_tag('LEMON', self.untagged_question.tags)
     tags_eq(self.untagged_question, [u'lemon'])
Esempio n. 16
0
 def test_add_new_case_insensitive(self):
     """Adding a tag differing only in case from existing ones shouldn't
     create a new tag."""
     self.client.post(_add_async_tag_url(), data={'tag-name': 'RED'},
                      HTTP_X_REQUESTED_WITH='XMLHttpRequest')
     tags_eq(Question.objects.get(pk=1), ['red'])
Esempio n. 17
0
 def test_add_new_tag(self):
     """Assert adding a nonexistent tag sychronously creates & adds it."""
     self.client.post(_add_tag_url(), data={'tag-name': 'nonexistent tag'})
     tags_eq(Question.objects.get(pk=1), ['nonexistent tag'])
Esempio n. 18
0
 def test_add_existing_case_insensitive(self):
     """Assert add_existing_tag works case-insensitively."""
     add_existing_tag('LEMON', self.untagged_question.tags)
     tags_eq(self.untagged_question, [u'lemon'])
Esempio n. 19
0
 def test_add_new_tag(self):
     """Assert adding a nonexistent tag sychronously creates & adds it."""
     self.client.post(_add_tag_url(), data={'tag-name': 'nonexistent tag'})
     tags_eq(Question.objects.get(pk=1), ['nonexistent tag'])