Exemplo n.º 1
0
    def test_hides_edition_link_for_standard_users(self):

        self.client.logout()

        user = factories.PixelerFactory(
            is_active=True,
            is_staff=False,
            is_superuser=False,
        )
        self.client.login(
            username=user.username,
            password=factories.PIXELER_PASSWORD,
        )

        response = self.client.get(self.url)

        admin_url = reverse('admin:core_pixelset_change',
                            args=(str(self.pixel_set.id), ))
        title = 'Edit this Pixel Set from the admin'
        expected = (f'<a href="{admin_url}" title="{title}" class="edit">'
                    '<i class="fa fa-pencil" aria-hidden="true"></i>'
                    'edit'
                    '</a>')
        self.assertNotContains(
            response,
            expected,
            html=True,
        )
Exemplo n.º 2
0
    def setUp(self):

        self.user = factories.PixelerFactory(
            is_active=True,
            is_staff=True,
            is_superuser=True,
        )
        self.client.login(
            username=self.user.username,
            password=factories.PIXELER_PASSWORD,
        )
        self.url = reverse('explorer:pixelset_selection_clear')
Exemplo n.º 3
0
    def setUp(self):

        self.user = factories.PixelerFactory(
            is_active=True,
            is_staff=True,
            is_superuser=True,
        )
        self.client.login(
            username=self.user.username,
            password=factories.PIXELER_PASSWORD,
        )
        self.pixel_set = factories.PixelSetFactory()
        self.pixels = factories.PixelFactory.create_batch(
            2, pixel_set=self.pixel_set)
        self.url = self.pixel_set.get_absolute_url()
Exemplo n.º 4
0
    def test_renders_the_home_authenticated_view_when_connected(self):

        self.user = factories.PixelerFactory(
            is_active=True,
            is_staff=True,
            is_superuser=True,
        )
        self.client.login(
            username=self.user.username,
            password=factories.PIXELER_PASSWORD,
        )

        response = self.client.get(self.url)

        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'core/home-authenticated.html')
Exemplo n.º 5
0
    def setUp(self):

        self.user = factories.PixelerFactory(
            is_active=True,
            is_staff=True,
            is_superuser=True,
        )
        self.client.login(
            username=self.user.username,
            password=factories.PIXELER_PASSWORD,
        )
        self.url = reverse('explorer:pixelset_deselect')
        self.pixel_sets = factories.PixelSetFactory.create_batch(2)
        data = {'pixel_sets': [str(p.id) for p in self.pixel_sets]}
        self.client.post(reverse('explorer:pixelset_select'),
                         data,
                         follow=True)
Exemplo n.º 6
0
    def setUp(self):

        self.user = factories.PixelerFactory(
            is_active=True,
            is_staff=True,
            is_superuser=True,
        )
        self.client.login(
            username=self.user.username,
            password=factories.PIXELER_PASSWORD,
        )

        self.pixel_set = factories.PixelSetFactory()
        self.pixel_set.analysis.experiments.add(factories.ExperimentFactory())
        factories.PixelFactory.create_batch(10, pixel_set=self.pixel_set)

        self.url = self.pixel_set.get_export_pixels_url()
Exemplo n.º 7
0
    def setUp(self):

        self.user = factories.PixelerFactory(
            is_active=True,
            is_staff=True,
            is_superuser=True,
        )
        self.client.login(
            username=self.user.username,
            password=factories.PIXELER_PASSWORD,
        )

        self.pixel_set = factories.PixelSetFactory()
        self.pixels = factories.PixelFactory.create_batch(
            2, pixel_set=self.pixel_set)

        self.url = reverse('explorer:pixelset_detail_quality_scores',
                           kwargs={'pk': str(self.pixel_set.id)})
Exemplo n.º 8
0
    def setUp(self):

        self.user = factories.PixelerFactory(
            is_active=True,
            is_staff=True,
            is_superuser=True,
        )
        self.client.login(
            username=self.user.username,
            password=factories.PIXELER_PASSWORD,
        )

        self.pixel_set = factories.PixelSetFactory()
        self.pixels = factories.PixelFactory.create_batch(
            2,
            pixel_set=self.pixel_set
        )

        self.url = reverse('explorer:pixelset_selection_cumulative_values')