def test_project_party_resource_detail(self):
        actual = reverse(
            version_ns('party:resource_detail'),
            kwargs={
                'organization': 'habitat',
                'project': '123abc',
                'party': '123456123456123456123456',
                'resource': '352091238623324256823'
            }
        )
        expected = version_url(
            '/organizations/habitat/projects/123abc/'
            'parties/123456123456123456123456/'
            'resources/352091238623324256823/')
        assert actual == expected

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/'
            'parties/123456123456123456123456/'
            'resources/352091238623324256823/'))
        assert resolved.func.__name__ == api.PartyResourceDetail.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['party'] == '123456123456123456123456'
        assert resolved.kwargs['resource'] == '352091238623324256823'
    def test_user_list(self):
        actual = reverse(version_ns('user:list'))
        expected = version_url('/users/')
        assert actual == expected

        resolved = resolve(version_url('/users/'))
        assert resolved.func.__name__ == api.UserAdminList.__name__
    def test_project_users_detail(self):
        actual = reverse(
            version_ns('organization:project_users_detail'),
            kwargs={'organization': 'habitat',
                    'project': '123abc',
                    'username': '******'}
        )
        expected = version_url(
            '/organizations/habitat/projects/123abc/users/barbara/')
        assert actual == expected

        actual = reverse(
            version_ns('organization:project_users_detail'),
            kwargs={'organization': 'habitat',
                    'project': '123abc',
                    'username': '******'}
        )
        expected = version_url(
            '/organizations/habitat/projects/123abc/users/barbara-@+./')
        assert actual == expected

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/users/barbara/'))
        assert resolved.func.__name__ == api.ProjectUsersDetail.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['username'] == 'barbara'

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/users/barbara-@+./'))
        assert resolved.func.__name__ == api.ProjectUsersDetail.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['username'] == 'barbara-@+.'
    def test_organization_users_detail(self):
        assert (reverse(
            version_ns('organization:users_detail'),
            kwargs={
                'organization': 'org-slug',
                'username': '******'
            }) == version_url('/organizations/org-slug/users/n_smith/'))

        assert (reverse(
            version_ns('organization:users_detail'),
            kwargs={
                'organization': 'org-slug',
                'username': '******'
            }) == version_url('/organizations/org-slug/users/n_smith-@+./'))

        resolved = resolve(
            version_url('/organizations/org-slug/users/n_smith/'))

        assert resolved.func.__name__ == api.OrganizationUsersDetail.__name__
        assert resolved.kwargs['organization'] == 'org-slug'
        assert resolved.kwargs['username'] == 'n_smith'

        resolved = resolve(
            version_url('/organizations/org-slug/users/n_smith-@+./'))

        assert resolved.func.__name__ == api.OrganizationUsersDetail.__name__
        assert resolved.kwargs['organization'] == 'org-slug'
        assert resolved.kwargs['username'] == 'n_smith-@+.'
    def test_spatial_unit_resource_detail(self):
        actual = reverse(
            version_ns('spatial:resource_detail'),
            kwargs={
                'organization': 'habitat',
                'project': '123abc',
                'location': '123456123456123456123456',
                'resource': '12340293170489127699348'
            }
        )
        expected = version_url(
            '/organizations/habitat/projects/123abc/'
            'spatial/123456123456123456123456/'
            'resources/12340293170489127699348/')
        assert actual == expected

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/'
            'spatial/123456123456123456123456/'
            'resources/12340293170489127699348/'))
        assert (resolved.func.__name__ ==
                api.SpatialUnitResourceDetail.__name__)
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['location'] == '123456123456123456123456'
        assert resolved.kwargs['resource'] == '12340293170489127699348'
    def test_user_list(self):
        actual = reverse(version_ns('user:list'))
        expected = version_url('/users/')
        assert actual == expected

        resolved = resolve(version_url('/users/'))
        assert resolved.func.__name__ == api.UserAdminList.__name__
    def generic_test_project_relationship_detail(self, rel_class, view):
        actual = reverse(version_ns(
            'relationship:{}_rel_detail'.format(rel_class)),
                         kwargs={
                             'organization':
                             'habitat',
                             'project':
                             '123abc',
                             '{}_rel_id'.format(rel_class):
                             '654321654321654321654321',
                         })
        expected = version_url(
            '/organizations/habitat/projects/123abc/'
            'relationships/{}/654321654321654321654321/'.format(rel_class))
        assert actual == expected

        resolved = resolve(
            version_url('/organizations/habitat/projects/123abc/'
                        'relationships/{}/654321654321654321654321/'.format(
                            rel_class)))
        assert resolved.func.__name__ == view.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['{}_rel_id'.format(rel_class)] == (
            '654321654321654321654321')
    def test_project_party_resource_detail(self):
        actual = reverse(
            version_ns('relationship:tenure_rel_resource_detail'),
            kwargs={
                'organization': 'habitat',
                'project': '123abc',
                'tenure_rel_id': '123456123456123456123456',
                'resource': '352091238623324256823'
            }
        )
        expected = version_url(
            '/organizations/habitat/projects/123abc/relationships/'
            'tenure/123456123456123456123456/'
            'resources/352091238623324256823/')
        assert actual == expected

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/relationships/'
            'tenure/123456123456123456123456/'
            'resources/352091238623324256823/'))
        assert (resolved.func.__name__ ==
                api.TenureRelationshipResourceDetail.__name__)
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['tenure_rel_id'] == '123456123456123456123456'
        assert resolved.kwargs['resource'] == '352091238623324256823'
    def test_organization_detail(self):
        assert (reverse(version_ns('organization:detail'),
                        kwargs={'organization': 'org-slug'
                                }) == version_url('/organizations/org-slug/'))

        resolved = resolve(version_url('/organizations/org-slug/'))
        assert resolved.func.__name__ == api.OrganizationDetail.__name__
        assert resolved.kwargs['organization'] == 'org-slug'
    def test_organization_users(self):
        assert (reverse(version_ns('organization:users'),
                        kwargs={'organization': 'org-slug'}) ==
                version_url('/organizations/org-slug/users/'))

        resolved = resolve(version_url('/organizations/org-slug/users/'))
        assert resolved.func.__name__ == api.OrganizationUsers.__name__
        assert resolved.kwargs['organization'] == 'org-slug'
    def test_user_detail(self):
        actual = reverse(version_ns('user:detail'),
                         kwargs={'username': '******'})

        expected = version_url('/users/user-name/')
        assert actual == expected

        resolved = resolve(version_url('/users/user-name/'))
        assert resolved.func.__name__ == api.UserAdminDetail.__name__
        assert resolved.kwargs['username'] == 'user-name'
    def test_user_detail(self):
        actual = reverse(version_ns('user:detail'),
                         kwargs={'username': '******'})

        expected = version_url('/users/user-name/')
        assert actual == expected

        resolved = resolve(version_url('/users/user-name/'))
        assert resolved.func.__name__ == api.UserAdminDetail.__name__
        assert resolved.kwargs['username'] == 'user-name'
    def test_project_list(self):
        self.assertEqual(
            reverse(version_ns('project:list')),
            version_url('/projects/')
        )

        resolved = resolve(version_url('/projects/'))
        self.assertEqual(
            resolved.func.__name__,
            api.ProjectList.__name__)
Beispiel #14
0
    def test_questionnaire(self):
        assert (reverse(version_ns('questionnaires:detail'),
                        kwargs={'organization': 'org', 'project': 'prj'}) ==
                version_url('/organizations/org/projects/prj/questionnaire/'))

        resolved = resolve(
            version_url('/organizations/org/projects/prj/questionnaire/'))
        assert resolved.func.__name__ == api.QuestionnaireDetail.__name__
        assert resolved.kwargs['organization'] == 'org'
        assert resolved.kwargs['project'] == 'prj'
    def test_organization_project_list(self):
        actual = reverse(version_ns('organization:project_list'),
                         kwargs={'organization': 'habitat'})

        expected = version_url('/organizations/habitat/projects/')

        assert actual == expected

        resolved = resolve(version_url('/organizations/habitat/projects/'))
        assert resolved.func.__name__ == api.OrganizationProjectList.__name__
        assert resolved.kwargs['organization'] == 'habitat'
    def test_organization_project_list(self):
        actual = reverse(
            version_ns('organization:project_list'),
            kwargs={'organization': 'habitat'}
        )

        expected = version_url('/organizations/habitat/projects/')

        assert actual == expected

        resolved = resolve(version_url('/organizations/habitat/projects/'))
        assert resolved.func.__name__ == api.OrganizationProjectList.__name__
        assert resolved.kwargs['organization'] == 'habitat'
    def test_project_users(self):
        actual = reverse(
            version_ns('organization:project_users'),
            kwargs={'organization': 'habitat', 'project': '123abc'}
        )
        expected = version_url('/organizations/habitat/projects/123abc/users/')
        assert actual == expected

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/users/'))
        assert resolved.func.__name__ == api.ProjectUsers.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
    def test_project_users(self):
        actual = reverse(version_ns('organization:project_users'),
                         kwargs={
                             'organization': 'habitat',
                             'project': '123abc'
                         })
        expected = version_url('/organizations/habitat/projects/123abc/users/')
        assert actual == expected

        resolved = resolve(
            version_url('/organizations/habitat/projects/123abc/users/'))
        assert resolved.func.__name__ == api.ProjectUsers.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
    def test_project_spatial_unit_list(self):
        actual = reverse(version_ns('spatial:list'),
                         kwargs={
                             'organization': 'habitat',
                             'project': '123abc',
                         })
        expected = version_url(
            '/organizations/habitat/projects/123abc/spatial/')
        assert actual == expected

        resolved = resolve(
            version_url('/organizations/habitat/projects/123abc/spatial/'))
        assert resolved.func.__name__ == api.SpatialUnitList.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
    def test_project_party_list(self):
        actual = reverse(version_ns('party:list'),
                         kwargs={
                             'organization': 'habitat',
                             'project': '123abc',
                         })
        expected = version_url(
            '/organizations/habitat/projects/123abc/parties/')
        assert actual == expected

        resolved = resolve(
            version_url('/organizations/habitat/projects/123abc/parties/'))
        assert resolved.func.__name__ == api.PartyList.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
    def test_project_spatial_list(self):
        actual = reverse(
            version_ns('resources:project_spatial_resource_list'),
            kwargs={'organization': 'habitat',
                    'project': '123abc'}
        )
        expected = version_url(
            '/organizations/habitat/projects/123abc/spatialresources/')
        assert actual == expected

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/spatialresources/'))
        assert (resolved.func.__name__ ==
                api.ProjectSpatialResources.__name__)
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
    def test_project_party_list(self):
        actual = reverse(
            version_ns('party:list'),
            kwargs={
                'organization': 'habitat',
                'project': '123abc',
            }
        )
        expected = version_url(
            '/organizations/habitat/projects/123abc/parties/')
        assert actual == expected

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/parties/'))
        assert resolved.func.__name__ == api.PartyList.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
    def test_project_spatial_unit_list(self):
        actual = reverse(
            version_ns('spatial:list'),
            kwargs={
                'organization': 'habitat',
                'project': '123abc',
            }
        )
        expected = version_url(
            '/organizations/habitat/projects/123abc/spatial/')
        assert actual == expected

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/spatial/'))
        assert resolved.func.__name__ == api.SpatialUnitList.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
    def test_project_detail(self):
        actual = reverse(
            version_ns('resources:project_detail'),
            kwargs={'organization': 'habitat',
                    'project': '123abc',
                    'resource': '456def'}
        )
        expected = version_url(
            '/organizations/habitat/projects/123abc/resources/456def/')
        assert actual == expected

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/resources/456def/'))
        assert resolved.func.__name__ == api.ProjectResourcesDetail.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['resource'] == '456def'
    def test_project_party_detail(self):
        actual = reverse(version_ns('party:detail'),
                         kwargs={
                             'organization': 'habitat',
                             'project': '123abc',
                             'party': '123456123456123456123456',
                         })
        expected = version_url('/organizations/habitat/projects/123abc/'
                               'parties/123456123456123456123456/')
        assert actual == expected

        resolved = resolve(
            version_url('/organizations/habitat/projects/123abc/'
                        'parties/123456123456123456123456/'))
        assert resolved.func.__name__ == api.PartyDetail.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['party'] == '123456123456123456123456'
    def test_project_spatial_unit_detail(self):
        actual = reverse(version_ns('spatial:detail'),
                         kwargs={
                             'organization': 'habitat',
                             'project': '123abc',
                             'spatial_id': '123456123456123456123456',
                         })
        expected = version_url('/organizations/habitat/projects/123abc/'
                               'spatial/123456123456123456123456/')
        assert actual == expected

        resolved = resolve(
            version_url('/organizations/habitat/projects/123abc/'
                        'spatial/123456123456123456123456/'))
        assert resolved.func.__name__ == api.SpatialUnitDetail.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['spatial_id'] == '123456123456123456123456'
    def test_project_spatial_unit_relationships_list(self):
        actual = reverse(version_ns('spatial:rel_list'),
                         kwargs={
                             'organization': 'habitat',
                             'project': '123abc',
                             'spatial_id': '123456123456123456123456',
                         })
        expected = version_url(
            '/organizations/habitat/projects/123abc/'
            'spatial/123456123456123456123456/relationships/')
        assert actual == expected

        resolved = resolve(
            version_url('/organizations/habitat/projects/123abc/'
                        'spatial/123456123456123456123456/relationships/'))
        assert resolved.func.__name__ == RelationshipList.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['spatial_id'] == '123456123456123456123456'
    def generic_test_project_relationship_create(self, rel_class, view):
        actual = reverse(
            version_ns('relationship:{}_rel_create'.format(rel_class)),
            kwargs={
                'organization': 'habitat',
                'project': '123abc',
            }
        )
        expected = version_url(
            '/organizations/habitat/projects/123abc/'
            'relationships/{}/'.format(rel_class))
        assert actual == expected

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/'
            'relationships/{}/'.format(rel_class)))
        assert resolved.func.__name__ == view.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
    def test_project_party_resource_list(self):
        actual = reverse(version_ns('relationship:tenure_rel_resource_list'),
                         kwargs={
                             'organization': 'habitat',
                             'project': '123abc',
                             'tenure_rel_id': '123456123456123456123456',
                         })
        expected = version_url(
            '/organizations/habitat/projects/123abc/relationships/'
            'tenure/123456123456123456123456/resources/')
        assert actual == expected

        resolved = resolve(
            version_url('/organizations/habitat/projects/123abc/relationships/'
                        'tenure/123456123456123456123456/resources/'))
        assert (resolved.func.__name__ ==
                api.TenureRelationshipResourceList.__name__)
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['tenure_rel_id'] == '123456123456123456123456'
    def test_project_spatial_unit_relationships_list(self):
        actual = reverse(
            version_ns('spatial:rel_list'),
            kwargs={
                'organization': 'habitat',
                'project': '123abc',
                'location': '123456123456123456123456',
            }
        )
        expected = version_url(
            '/organizations/habitat/projects/123abc/'
            'spatial/123456123456123456123456/relationships/')
        assert actual == expected

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/'
            'spatial/123456123456123456123456/relationships/'))
        assert resolved.func.__name__ == RelationshipList.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['location'] == '123456123456123456123456'
    def test_project_spatial_unit_detail(self):
        actual = reverse(
            version_ns('spatial:detail'),
            kwargs={
                'organization': 'habitat',
                'project': '123abc',
                'location': '123456123456123456123456',
            }
        )
        expected = version_url(
            '/organizations/habitat/projects/123abc/'
            'spatial/123456123456123456123456/')
        assert actual == expected

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/'
            'spatial/123456123456123456123456/'))
        assert resolved.func.__name__ == api.SpatialUnitDetail.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['location'] == '123456123456123456123456'
    def test_project_party_detail(self):
        actual = reverse(
            version_ns('party:detail'),
            kwargs={
                'organization': 'habitat',
                'project': '123abc',
                'party': '123456123456123456123456',
            }
        )
        expected = version_url(
            '/organizations/habitat/projects/123abc/'
            'parties/123456123456123456123456/')
        assert actual == expected

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/'
            'parties/123456123456123456123456/'))
        assert resolved.func.__name__ == api.PartyDetail.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['party'] == '123456123456123456123456'
    def test_project_party_resource_detail(self):
        actual = reverse(version_ns('party:resource_detail'),
                         kwargs={
                             'organization': 'habitat',
                             'project': '123abc',
                             'party': '123456123456123456123456',
                             'resource': '352091238623324256823'
                         })
        expected = version_url('/organizations/habitat/projects/123abc/'
                               'parties/123456123456123456123456/'
                               'resources/352091238623324256823/')
        assert actual == expected

        resolved = resolve(
            version_url('/organizations/habitat/projects/123abc/'
                        'parties/123456123456123456123456/'
                        'resources/352091238623324256823/'))
        assert resolved.func.__name__ == api.PartyResourceDetail.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['party'] == '123456123456123456123456'
        assert resolved.kwargs['resource'] == '352091238623324256823'
    def test_project_party_resource_list(self):
        actual = reverse(
            version_ns('relationship:tenure_rel_resource_list'),
            kwargs={
                'organization': 'habitat',
                'project': '123abc',
                'tenure_rel_id': '123456123456123456123456',
            }
        )
        expected = version_url(
            '/organizations/habitat/projects/123abc/relationships/'
            'tenure/123456123456123456123456/resources/')
        assert actual == expected

        resolved = resolve(version_url(
            '/organizations/habitat/projects/123abc/relationships/'
            'tenure/123456123456123456123456/resources/'))
        assert (resolved.func.__name__ ==
                api.TenureRelationshipResourceList.__name__)
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['tenure_rel_id'] == '123456123456123456123456'
    def test_spatial_unit_resource_detail(self):
        actual = reverse(version_ns('spatial:resource_detail'),
                         kwargs={
                             'organization': 'habitat',
                             'project': '123abc',
                             'location': '123456123456123456123456',
                             'resource': '12340293170489127699348'
                         })
        expected = version_url('/organizations/habitat/projects/123abc/'
                               'spatial/123456123456123456123456/'
                               'resources/12340293170489127699348/')
        assert actual == expected

        resolved = resolve(
            version_url('/organizations/habitat/projects/123abc/'
                        'spatial/123456123456123456123456/'
                        'resources/12340293170489127699348/'))
        assert (
            resolved.func.__name__ == api.SpatialUnitResourceDetail.__name__)
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['location'] == '123456123456123456123456'
        assert resolved.kwargs['resource'] == '12340293170489127699348'
    def test_organization_users_detail(self):
        assert (reverse(version_ns('organization:users_detail'),
                        kwargs={'organization': 'org-slug',
                                'username': '******'}) ==
                version_url('/organizations/org-slug/users/n_smith/'))

        assert (reverse(version_ns('organization:users_detail'),
                        kwargs={'organization': 'org-slug',
                                'username': '******'}) ==
                version_url('/organizations/org-slug/users/n_smith-@+./'))

        resolved = resolve(
            version_url('/organizations/org-slug/users/n_smith/'))

        assert resolved.func.__name__ == api.OrganizationUsersDetail.__name__
        assert resolved.kwargs['organization'] == 'org-slug'
        assert resolved.kwargs['username'] == 'n_smith'

        resolved = resolve(
            version_url('/organizations/org-slug/users/n_smith-@+./'))

        assert resolved.func.__name__ == api.OrganizationUsersDetail.__name__
        assert resolved.kwargs['organization'] == 'org-slug'
        assert resolved.kwargs['username'] == 'n_smith-@+.'
    def test_project_party_resource_detail(self):
        actual = reverse(version_ns('relationship:tenure_rel_resource_detail'),
                         kwargs={
                             'organization': 'habitat',
                             'project': '123abc',
                             'tenure_rel_id': '123456123456123456123456',
                             'resource': '352091238623324256823'
                         })
        expected = version_url(
            '/organizations/habitat/projects/123abc/relationships/'
            'tenure/123456123456123456123456/'
            'resources/352091238623324256823/')
        assert actual == expected

        resolved = resolve(
            version_url('/organizations/habitat/projects/123abc/relationships/'
                        'tenure/123456123456123456123456/'
                        'resources/352091238623324256823/'))
        assert (resolved.func.__name__ ==
                api.TenureRelationshipResourceDetail.__name__)
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['tenure_rel_id'] == '123456123456123456123456'
        assert resolved.kwargs['resource'] == '352091238623324256823'
    def test_project_users_detail(self):
        actual = reverse(version_ns('organization:project_users_detail'),
                         kwargs={
                             'organization': 'habitat',
                             'project': '123abc',
                             'username': '******'
                         })
        expected = version_url(
            '/organizations/habitat/projects/123abc/users/barbara/')
        assert actual == expected

        actual = reverse(version_ns('organization:project_users_detail'),
                         kwargs={
                             'organization': 'habitat',
                             'project': '123abc',
                             'username': '******'
                         })
        expected = version_url(
            '/organizations/habitat/projects/123abc/users/barbara-@+./')
        assert actual == expected

        resolved = resolve(
            version_url(
                '/organizations/habitat/projects/123abc/users/barbara/'))
        assert resolved.func.__name__ == api.ProjectUsersDetail.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['username'] == 'barbara'

        resolved = resolve(
            version_url(
                '/organizations/habitat/projects/123abc/users/barbara-@+./'))
        assert resolved.func.__name__ == api.ProjectUsersDetail.__name__
        assert resolved.kwargs['organization'] == 'habitat'
        assert resolved.kwargs['project'] == '123abc'
        assert resolved.kwargs['username'] == 'barbara-@+.'
    def test_account_user(self):
        assert reverse(version_ns('accounts:user')) == version_url('/account/')

        resolved = resolve(version_url('/account/'))
        assert resolved.func.__name__ == api.AccountUser.__name__
    def test_account_verify_phone(self):
        assert (reverse(version_ns('accounts:verify_phone')) == version_url(
            '/account/verify/phone/'))

        resolved = resolve(version_url('/account/verify/phone/'))
        assert resolved.func.__name__ == api.ConfirmPhoneView.__name__
    def test_account_password(self):
        assert (reverse(version_ns('accounts:password')) == version_url(
            '/account/password/'))

        resolved = resolve(version_url('/account/password/'))
        assert resolved.func.__name__ == api.SetPasswordView.__name__
    def test_account_login(self):
        assert (reverse(
            version_ns('accounts:login')) == version_url('/account/login/'))

        resolved = resolve(version_url('/account/login/'))
        assert resolved.func.__name__ == api.AccountLogin.__name__
    def test_account_register(self):
        assert (reverse(version_ns('accounts:register')) == version_url(
            '/account/register/'))

        resolved = resolve(version_url('/account/register/'))
        assert resolved.func.__name__ == api.AccountRegister.__name__
    def test_organization_list(self):
        assert (reverse(
            version_ns('organization:list')) == version_url('/organizations/'))

        resolved = resolve(version_url('/organizations/'))
        assert resolved.func.__name__ == api.OrganizationList.__name__
    def test_account_register(self):
        assert (reverse(version_ns('accounts:register')) ==
                version_url('/account/register/'))

        resolved = resolve(version_url('/account/register/'))
        assert resolved.func.__name__ == api.AccountRegister.__name__
    def test_project_list(self):
        self.assertEqual(reverse(version_ns('project:list')),
                         version_url('/projects/'))

        resolved = resolve(version_url('/projects/'))
        self.assertEqual(resolved.func.__name__, api.ProjectList.__name__)
    def test_account_login(self):
        assert (reverse(version_ns('accounts:login')) ==
                version_url('/account/login/'))

        resolved = resolve(version_url('/account/login/'))
        assert resolved.func.__name__ == api.AccountLogin.__name__
    def test_account_password(self):
        assert (reverse(version_ns('accounts:password')) ==
                version_url('/account/password/'))

        resolved = resolve(version_url('/account/password/'))
        assert resolved.func.__name__ == api.SetPasswordView.__name__
    def test_account_user(self):
        assert reverse(version_ns('accounts:user')) == version_url('/account/')

        resolved = resolve(version_url('/account/'))
        assert resolved.func.__name__ == api.AccountUser.__name__
    def test_organization_list(self):
        assert (reverse(version_ns('organization:list')) ==
                version_url('/organizations/'))

        resolved = resolve(version_url('/organizations/'))
        assert resolved.func.__name__ == api.OrganizationList.__name__
    def test_account_activate(self):
        assert (reverse(version_ns('accounts:activate')) == version_url(
            '/account/activate/'))

        resolved = resolve(version_url('/account/activate/'))
        assert resolved.func.__name__ == api.AccountVerify.__name__
    def test_password_reset(self):
        self.assertEqual(reverse(version_ns('accounts:password_reset')),
                         version_url('/account/password/reset/'))

        resolved = resolve(version_url('/account/password/reset/'))
        assert resolved.func.__name__ == api.PasswordReset.__name__