'Tags can be collated or fetched by namespace'

def test_all_ns(self):

    apple = self.food_model.objects.create(name='apple')
    expected_tags = {u'': [u'foo', u'bar', u'baz'], u'int:': [u'int:1', u'int:2'], u'string:': [u'string:asdf'], u'color:': [u'color:red'], u'system:contest:': [u'system:contest:finalist']}
    for tags in expected_tags.values():
        apple.tags.add(*tags)
    ns_tags = apple.tags.all_ns()
    expected_ns = expected_tags.keys()
    expected_ns.sort()
    result_ns = ns_tags.keys()
    result_ns.sort()
    self.assertEqual(expected_ns, result_ns)
    for ns in expected_ns:
        self.assert_tags_equal(ns_tags[ns], expected_tags[ns])
        self.assert_tags_equal(apple.tags.all_ns(ns), expected_tags[ns])
