def _get_package_new_page_as_sysadmin(app):
    user = Sysadmin()
    env = {'REMOTE_USER': user['name'].encode('ascii')}
    response = app.get(
        url='/camel-photos/new',
        extra_environ=env,
    )
    return env, response
def _get_organization_new_page_as_sysadmin(app):
    user = Sysadmin()
    env = {'REMOTE_USER': user['name'].encode('ascii')}
    response = app.get(
        url='/organization/new',
        extra_environ=env,
    )
    return env, response
 def test_notes_field_displayed(self):
     user = Sysadmin()
     d = Dataset(
         user=user,
         type='dataset',
         name='plain-jane',
         notes='# styled notes',
     )
     app = self._get_test_app()
     response = app.get(url='/dataset/plain-jane')
     assert_true('<h1>styled notes' in response.body)
 def test_choice_field_shows_labels(self):
     user = Sysadmin()
     d = Dataset(
         user=user,
         type='camel-photos',
         name='with-choice',
         category='hybrid',
         )
     app = self._get_test_app()
     response = app.get(url='/dataset/with-choice')
     assert_true('Hybrid Camel' in response.body)
示例#5
0
    def test_organization_displays_custom_fields(self):
        user = Sysadmin()
        Organization(
            user=user,
            name='org-one',
            department_id='3008',
        )

        app = self._get_test_app()
        response = app.get(url='/organization/about/org-one')
        assert_true('Department ID' in response.body)
示例#6
0
    def test_group_displays_custom_fields(self):
        user = Sysadmin()
        Group(
            user=user,
            name='group-one',
            bookface='theoneandonly',
        )

        app = self._get_test_app()
        response = app.get(url='/group/about/group-one')
        assert_true('Bookface' in response.body)
    def test_choice_field_does_not_show_list_if_one_options(self):
        user = Sysadmin()
        d = Dataset(
            user=user,
            type='camel-photos',
            name='with-multiple-choice-one',
            personality=['friendly'],
        )
        app = self._get_test_app()
        response = app.get(url='/dataset/with-multiple-choice-one')

        assert_true('Often friendly' in response.body)
        assert_true('<ul><li>Often friendly</li></ul>' not in response.body)
    def test_choice_field_shows_list_if_multiple_options(self):
        user = Sysadmin()
        d = Dataset(
            user=user,
            type='camel-photos',
            name='with-multiple-choice-n',
            personality=['friendly', 'spits'],
        )
        app = self._get_test_app()
        response = app.get(url='/dataset/with-multiple-choice-n')

        assert_true('<ul><li>Often friendly</li><li>Tends to spit</li></ul>' in
                    response.body)
    def test_dataset_displays_custom_fields(self):
        user = Sysadmin()
        Dataset(
            user=user,
            type='camel-photos',
            name='set-one',
            humps=3,
            resources=[{
                'url':"http://example.com/camel.txt",
                'camels_in_photo': 2}])

        app = self._get_test_app()
        response = app.get(url='/dataset/set-one')
        assert_true('Humps' in response.body)
    def test_resource_displays_custom_fields(self):
        user = Sysadmin()
        d = Dataset(user=user,
                    type='camel-photos',
                    name='set-two',
                    humps=3,
                    resources=[{
                        'url': "http://example.com/camel.txt",
                        'camels_in_photo': 2
                    }])

        app = self._get_test_app()
        response = app.get(url='/dataset/set-two/resource/' +
                           d['resources'][0]['id'])
        assert_true('Camels in Photo' in response.body)
    def test_resource_displays_custom_fields(self):
        user = Sysadmin()
        d = Dataset(user=user,
                    type='camel-photos',
                    name='set-two',
                    humps=3,
                    photographer='John Newton',
                    photographer_email='*****@*****.**',
                    resources=[{
                        'url': "http://example.com/camel.txt",
                        'camels_in_photo': 2,
                        'date': '2015-01-01'
                    }])

        app = self._get_test_app()
        response = app.get(url='/dataset/set-two/resource/' +
                           d['resources'][0]['id'])
        assert_true('Camels in Photo' in response.body)
        assert_true('Date' in response.body)