<commit_before>from django.test import TestCase
from django.core.urlresolvers import reverse, resolve

class UserUrlsTest(TestCase):

    def test_user_new_collection_viewname_to_url(self):
        url = reverse('collection-new', kwargs={"user":"testuser"})
        self.assertEqual(url, '/users/testuser/collections/new/')

    def test_user_new_collection_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/new/')
        self.assertEqual(resolver.view_name, 'collection-new')
        self.assertEqual(resolver.kwargs['user'], 'testuser')

    def test_user_collection_details_viewname_to_url(self):
        url = reverse('collection-details', kwargs={"user":"testuser","collection":"testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/details/')

    def test_user_collection_details_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/details/')
        self.assertEqual(resolver.view_name, 'collection-details')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')

    def test_user_collection_home_viewname_to_url(self):
        url = reverse('collection-home', kwargs={"user":"testuser","collection":"testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/')

    def test_user_collection_home_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/')
        self.assertEqual(resolver.view_name, 'collection-home')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')

    def test_user_collection_edit_viewname_to_url(self):
        url = reverse('collection-edit', kwargs={"user":"testuser","collection":"testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/edit/')

    def test_user_collection_edit_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/edit/')
        self.assertEqual(resolver.view_name, 'collection-edit')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')

    def test_user_collection_about_viewname_to_url(self):
        url = reverse('collection-about', kwargs={"user":"testuser","collection":"testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/about/')

    def test_user_collection_about_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/about/')
        self.assertEqual(resolver.view_name, 'collection-about')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')

    def test_user_collection_versions_viewname_to_url(self):
        url = reverse('collection-versions', kwargs={"user":"testuser","collection":"testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/versions/')

    def test_user_collection_versions_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/versions/')
        self.assertEqual(resolver.view_name, 'collection-versions')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')

    def test_user_collection_concepts_viewname_to_url(self):
        url = reverse('collection-concepts', kwargs={"user":"testuser","collection":"testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/concepts/')

    def test_user_collection_concepts_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/concepts/')
        self.assertEqual(resolver.view_name, 'collection-concepts')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')


    def test_user_collection_mappings_viewname_to_url(self):
        url = reverse('collection-mappings', kwargs={"user": "testuser", "collection": "testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/mappings/')


    def test_user_collection_mappings_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/mappings/')
        self.assertEqual(resolver.view_name, 'collection-mappings')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')



    def test_user_collection_references_viewname_to_url(self):
        url = reverse('collection-references', kwargs={"user": "testuser", "collection": "testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/references/')


    def test_user_collection_references_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/references/')
        self.assertEqual(resolver.view_name, 'collection-references')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')

    def test_user_collection_delete_viewname_to_url(self):
        url = reverse('collection-delete', kwargs={"user": "testuser", "collection": "testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/delete/')


    def test_user_collection_delete_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/delete/')
        self.assertEqual(resolver.view_name, 'collection-delete')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')

    def test_user_source_delete_viewname_to_url(self):
        url = reverse('source-delete', kwargs={"user": "testuser", "source": "testsource"})
        self.assertEqual(url, '/users/testuser/sources/testsource/delete/')

    def test_user_source_delete_url_to_viewname(self):
        resolver = resolve('/users/testuser/sources/testsource/delete/')
        self.assertEqual(resolver.view_name, 'source-delete')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['source'], 'testsource')

    def test_user_collection_references_viewname_to_url(self):
        url = reverse('collection-references', kwargs={"user": "testuser", "collection": "collection1"})
        self.assertEqual(url, '/users/testuser/collections/collection1/references/')

    def test_user_collection_references_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/collection1/references/')
        self.assertEqual(resolver.view_name, 'collection-references')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'collection1')

    def test_user_collection_addReferences_viewname_to_url(self):
        url = reverse('collection-addreference', kwargs={"user": "testuser", "collection": "collection1"})
        self.assertEqual(url, '/users/testuser/collections/collection1/references/new/')

    def test_user_collection_addReferences_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/collection1/references/new/')
        self.assertEqual(resolver.view_name, 'collection-addreference')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'collection1')
<commit_msg>#179 [Bhawna, Ravinder] test cases for verion urls<commit_after>from django.test import TestCase
from django.core.urlresolvers import reverse, resolve

class UserUrlsTest(TestCase):

    def test_user_new_collection_viewname_to_url(self):
        url = reverse('collection-new', kwargs={"user":"testuser"})
        self.assertEqual(url, '/users/testuser/collections/new/')

    def test_user_new_collection_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/new/')
        self.assertEqual(resolver.view_name, 'collection-new')
        self.assertEqual(resolver.kwargs['user'], 'testuser')

    def test_user_collection_details_viewname_to_url(self):
        url = reverse('collection-details', kwargs={"user":"testuser","collection":"testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/details/')

    def test_user_collection_details_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/details/')
        self.assertEqual(resolver.view_name, 'collection-details')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')

    def test_user_collection_home_viewname_to_url(self):
        url = reverse('collection-home', kwargs={"user":"testuser","collection":"testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/')

    def test_user_collection_home_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/')
        self.assertEqual(resolver.view_name, 'collection-home')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')

    def test_user_collection_edit_viewname_to_url(self):
        url = reverse('collection-edit', kwargs={"user":"testuser","collection":"testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/edit/')

    def test_user_collection_edit_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/edit/')
        self.assertEqual(resolver.view_name, 'collection-edit')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')

    def test_user_collection_about_viewname_to_url(self):
        url = reverse('collection-about', kwargs={"user":"testuser","collection":"testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/about/')

    def test_user_collection_about_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/about/')
        self.assertEqual(resolver.view_name, 'collection-about')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')

    def test_user_collection_versions_viewname_to_url(self):
        url = reverse('collection-versions', kwargs={"user":"testuser","collection":"testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/versions/')

    def test_user_collection_versions_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/versions/')
        self.assertEqual(resolver.view_name, 'collection-versions')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')

    def test_user_collection_concepts_viewname_to_url(self):
        url = reverse('collection-concepts', kwargs={"user":"testuser","collection":"testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/concepts/')

    def test_user_collection_concepts_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/concepts/')
        self.assertEqual(resolver.view_name, 'collection-concepts')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')


    def test_user_collection_mappings_viewname_to_url(self):
        url = reverse('collection-mappings', kwargs={"user": "testuser", "collection": "testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/mappings/')


    def test_user_collection_mappings_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/mappings/')
        self.assertEqual(resolver.view_name, 'collection-mappings')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')



    def test_user_collection_references_viewname_to_url(self):
        url = reverse('collection-references', kwargs={"user": "testuser", "collection": "testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/references/')


    def test_user_collection_references_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/references/')
        self.assertEqual(resolver.view_name, 'collection-references')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')

    def test_user_collection_delete_viewname_to_url(self):
        url = reverse('collection-delete', kwargs={"user": "testuser", "collection": "testcol"})
        self.assertEqual(url, '/users/testuser/collections/testcol/delete/')


    def test_user_collection_delete_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/testcol/delete/')
        self.assertEqual(resolver.view_name, 'collection-delete')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'testcol')

    def test_user_source_delete_viewname_to_url(self):
        url = reverse('source-delete', kwargs={"user": "testuser", "source": "testsource"})
        self.assertEqual(url, '/users/testuser/sources/testsource/delete/')

    def test_user_source_delete_url_to_viewname(self):
        resolver = resolve('/users/testuser/sources/testsource/delete/')
        self.assertEqual(resolver.view_name, 'source-delete')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['source'], 'testsource')

    def test_user_collection_references_viewname_to_url(self):
        url = reverse('collection-references', kwargs={"user": "testuser", "collection": "collection1"})
        self.assertEqual(url, '/users/testuser/collections/collection1/references/')

    def test_user_collection_references_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/collection1/references/')
        self.assertEqual(resolver.view_name, 'collection-references')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'collection1')

    def test_user_collection_addReferences_viewname_to_url(self):
        url = reverse('collection-addreference', kwargs={"user": "testuser", "collection": "collection1"})
        self.assertEqual(url, '/users/testuser/collections/collection1/references/new/')

    def test_user_collection_addReferences_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/collection1/references/new/')
        self.assertEqual(resolver.view_name, 'collection-addreference')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'collection1')

    def test_user_collection_add_version_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/collection1/versions/new/')
        self.assertEqual(resolver.view_name, 'collection-version-new')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'collection1')

    def test_user_collection_add_version_viewname_to_url(self):
        url = reverse('collection-version-new', kwargs={"user": "testuser", "collection": "collection1"})
        self.assertEqual(url, '/users/testuser/collections/collection1/versions/new/')

    def test_user_collection_version_url_to_viewname(self):
        resolver = resolve('/users/testuser/collections/collection1/versions/')
        self.assertEqual(resolver.view_name, 'collection-versions')
        self.assertEqual(resolver.kwargs['user'], 'testuser')
        self.assertEqual(resolver.kwargs['collection'], 'collection1')

    def test_user_collection_version_viewname_to_url(self):
        url = reverse('collection-versions', kwargs={"user": "testuser", "collection": "collection1"})
        self.assertEqual(url, '/users/testuser/collections/collection1/versions/')




{'fraction_non_alphanumeric': 0.13852652503416574, 'fraction_numerical': 0.0016772269847185985, 'mean_word_length': 4.719005328596803, 'pattern_counts': {'":': 54, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6795872', 'n_tokens_mistral': 4721, 'n_tokens_neox': 4631, 'n_words': 543}