def test_signed_in_contributor(self):
        request = RequestFactory().get('/')
        request.user = User.objects.create(
            username='******'
        )
        UserProfile.objects.create(
            user=request.user,
            contributor=True,
        )
        with self.settings(USE_NEW_UPLOADER=True):
            data = nav_bar(request)['nav_bar']()
        eq_(data['unfinished_events'], 0)
        urls = [x[1] for x in data['items']]
        ok_('/' in urls)
        ok_('/about/' in urls)
        ok_(reverse('main:channels') in urls)
        ok_(reverse('main:calendar') in urls)
        ok_(reverse('main:tag_cloud') in urls)
        ok_(reverse('starred:home') in urls)
        ok_(reverse('new:home') in urls)
        ok_('/browserid/logout/' in urls)

        with self.settings(USE_NEW_UPLOADER=False):
            # the old way
            data = nav_bar(request)['nav_bar']()
        urls = [x[1] for x in data['items']]
        ok_(reverse('new:home') not in urls)
        ok_(reverse('suggest:start') in urls)
Esempio n. 2
0
    def test_signed_in_contributor(self):
        request = RequestFactory().get('/')
        request.user = User.objects.create(username='******')
        UserProfile.objects.create(
            user=request.user,
            contributor=True,
        )
        with self.settings(USE_NEW_UPLOADER=True):
            data = nav_bar(request)['nav_bar']()
        eq_(data['unfinished_events'], 0)
        urls = [x[1] for x in data['items']]
        ok_('/' in urls)
        ok_('/about/' in urls)
        ok_(reverse('main:channels') in urls)
        ok_(reverse('main:calendar') in urls)
        ok_(reverse('main:tag_cloud') in urls)
        ok_(reverse('starred:home') in urls)
        ok_(reverse('new:home') in urls)
        ok_('/browserid/logout/' in urls)

        with self.settings(USE_NEW_UPLOADER=False):
            # the old way
            data = nav_bar(request)['nav_bar']()
        urls = [x[1] for x in data['items']]
        ok_(reverse('new:home') not in urls)
        ok_(reverse('suggest:start') in urls)
    def test_signed_in_with_unfinished_events(self):
        request = RequestFactory().get('/')
        request.user = User.objects.create(username='******', )
        event = Event.objects.create(
            creator=request.user,
            status=Event.STATUS_INITIATED,
            start_time=timezone.now(),
        )
        upload = Upload.objects.create(user=request.user,
                                       url='https://aws.example.com/file.mov',
                                       size=123,
                                       mime_type='video/quicktime',
                                       event=event)
        event.upload = upload
        event.save()

        data = nav_bar(request)['nav_bar']()
        all_sub_items = [x[-1] for x in data['items']]
        # sub_items = all_sub_items[-1]
        # urls = [x[1] for x in sub_items]
        # under the second to last (new)
        sub_items = all_sub_items[-2]
        assert len(sub_items) == 5, len(sub_items)
        first = sub_items[0]
        eq_(first[0], 'Unfinished Videos (1)')
        eq_(first[1], reverse('new:home'))
    def test_signed_in_contributor(self):
        request = RequestFactory().get('/')
        request.user = User.objects.create(username='******')
        UserProfile.objects.create(
            user=request.user,
            contributor=True,
        )
        data = nav_bar(request)['nav_bar']()
        urls = [x[1] for x in data['items']]
        all_sub_items = [x[-1] for x in data['items']]

        ok_('/' in urls)
        ok_('/about/' in urls)
        ok_(reverse('main:channels') in urls)
        ok_(reverse('main:calendar') in urls)
        ok_(reverse('main:tag_cloud') in urls)
        # ok_(reverse('starred:home') in urls)
        ok_(reverse('new:home') in urls)
        # under the second to last (new)
        sub_items = all_sub_items[-2]
        urls = [x[1] for x in sub_items]
        assert len(urls) == 4
        ok_(reverse('new:home') + 'record' in urls)
        ok_(reverse('new:home') + 'upload' in urls)
        ok_(reverse('new:home') + 'youtube' in urls)
        ok_(reverse('suggest:start') + '#new' in urls)
        # under the last (you) there should be some personal links too
        sub_items = all_sub_items[-1]
        urls = [x[1] for x in sub_items]
        assert len(urls) == 3
        ok_(reverse('starred:home') in urls)
        ok_(reverse('search:savedsearches') in urls)
        ok_(reverse('manage:events') not in urls)
        ok_(reverse('authentication:signout') in urls)
    def test_signed_in_with_unfinished_events(self):
        request = RequestFactory().get('/')
        request.user = User.objects.create(
            username='******',
        )
        event = Event.objects.create(
            creator=request.user,
            status=Event.STATUS_INITIATED,
            start_time=timezone.now(),
        )
        upload = Upload.objects.create(
            user=request.user,
            url='https://aws.example.com/file.mov',
            size=123,
            mime_type='video/quicktime',
            event=event
        )
        event.upload = upload
        event.save()

        data = nav_bar(request)['nav_bar']()
        all_sub_items = [x[-1] for x in data['items']]
        # sub_items = all_sub_items[-1]
        # urls = [x[1] for x in sub_items]
        # under the second to last (new)
        sub_items = all_sub_items[-2]
        assert len(sub_items) == 5, len(sub_items)
        first = sub_items[0]
        eq_(first[0], 'Unfinished Videos (1)')
        eq_(first[1], reverse('new:home'))
Esempio n. 6
0
 def test_signed_in_staff(self):
     request = RequestFactory().get('/')
     request.user = User.objects.create(username='******', is_staff=True)
     data = nav_bar(request)['nav_bar']()
     urls = [x[1] for x in data['items']]
     ok_(reverse('main:tag_cloud') not in urls)
     ok_(reverse('manage:events') in urls)
 def test_signed_in_staff(self):
     request = RequestFactory().get('/')
     request.user = User.objects.create(username='******', is_staff=True)
     data = nav_bar(request)['nav_bar']()
     all_sub_items = [x[-1] for x in data['items']]
     sub_items = all_sub_items[-1]
     urls = [x[1] for x in sub_items]
     ok_(reverse('manage:dashboard') in urls)
 def test_signed_in_staff(self):
     request = RequestFactory().get('/')
     request.user = User.objects.create(
         username='******',
         is_staff=True
     )
     data = nav_bar(request)['nav_bar']()
     urls = [x[1] for x in data['items']]
     ok_(reverse('main:tag_cloud') not in urls)
     ok_(reverse('manage:events') in urls)
 def test_anonymous(self):
     request = RequestFactory().get('/')
     request.user = AnonymousUser()
     data = nav_bar(request)['nav_bar']()
     urls = [x[1] for x in data['items']]
     assert len(urls) == 5, len(urls)
     ok_('/' in urls)
     ok_('/about/' in urls)
     ok_(reverse('main:channels') in urls)
     ok_(reverse('main:calendar') in urls)
     ok_(reverse('main:tag_cloud') in urls)
 def test_anonymous(self):
     request = RequestFactory().get('/')
     request.user = AnonymousUser()
     data = nav_bar(request)['nav_bar']()
     urls = [x[1] for x in data['items']]
     assert len(urls) == 5, len(urls)
     ok_('/' in urls)
     ok_('/about/' in urls)
     ok_(reverse('main:channels') in urls)
     ok_(reverse('main:calendar') in urls)
     ok_(reverse('main:tag_cloud') in urls)
 def test_signed_in_staff(self):
     request = RequestFactory().get('/')
     request.user = User.objects.create(
         username='******',
         is_staff=True
     )
     data = nav_bar(request)['nav_bar']()
     all_sub_items = [x[-1] for x in data['items']]
     sub_items = all_sub_items[-1]
     urls = [x[1] for x in sub_items]
     ok_(reverse('manage:dashboard') in urls)
Esempio n. 12
0
 def test_anonymous(self):
     request = RequestFactory().get('/')
     request.user = AnonymousUser()
     data = nav_bar(request)['nav_bar']()
     eq_(data['unfinished_events'], 0)
     urls = [x[1] for x in data['items']]
     ok_('/' in urls)
     ok_('/about/' in urls)
     ok_(reverse('main:channels') in urls)
     ok_(reverse('main:calendar') in urls)
     ok_(reverse('main:tag_cloud') in urls)
     ok_(reverse('starred:home') in urls)
 def test_anonymous(self):
     request = RequestFactory().get('/')
     request.user = AnonymousUser()
     data = nav_bar(request)['nav_bar']()
     eq_(data['unfinished_events'], 0)
     urls = [x[1] for x in data['items']]
     ok_('/' in urls)
     ok_('/about/' in urls)
     ok_(reverse('main:channels') in urls)
     ok_(reverse('main:calendar') in urls)
     ok_(reverse('main:tag_cloud') in urls)
     ok_(reverse('starred:home') in urls)
    def test_signed_in_staff_with_change_event_permission(self):
        user = User.objects.create(
            username='******',
            is_staff=True,
            is_superuser=True,
        )
        assert user.has_perm('manage:change_event')

        request = RequestFactory().get('/')
        request.user = user

        data = nav_bar(request)['nav_bar']()
        all_sub_items = [x[-1] for x in data['items']]
        sub_items = all_sub_items[-1]
        urls = [x[1] for x in sub_items]
        ok_(reverse('manage:events') in urls)
    def test_signed_in_staff_with_change_event_permission(self):
        user = User.objects.create(
            username='******',
            is_staff=True,
            is_superuser=True,
        )
        assert user.has_perm('manage:change_event')

        request = RequestFactory().get('/')
        request.user = user

        data = nav_bar(request)['nav_bar']()
        all_sub_items = [x[-1] for x in data['items']]
        sub_items = all_sub_items[-1]
        urls = [x[1] for x in sub_items]
        ok_(reverse('manage:events') in urls)
    def test_signed_in_with_unfinished_events(self):
        request = RequestFactory().get('/')
        request.user = User.objects.create(username='******', )
        event = Event.objects.create(
            creator=request.user,
            status=Event.STATUS_INITIATED,
            start_time=timezone.now(),
        )
        upload = Upload.objects.create(user=request.user,
                                       url='https://aws.example.com/file.mov',
                                       size=123,
                                       mime_type='video/quicktime',
                                       event=event)
        event.upload = upload
        event.save()

        data = nav_bar(request)['nav_bar']()
        eq_(data['unfinished_events'], 1)
 def test_signed_in_contributor(self):
     request = RequestFactory().get('/')
     request.user = User.objects.create(username='******')
     UserProfile.objects.create(
         user=request.user,
         contributor=True,
     )
     data = nav_bar(request)['nav_bar']()
     eq_(data['unfinished_events'], 0)
     urls = [x[1] for x in data['items']]
     ok_('/' in urls)
     ok_('/about/' in urls)
     ok_(reverse('main:channels') in urls)
     ok_(reverse('main:calendar') in urls)
     ok_(reverse('main:tag_cloud') in urls)
     ok_(reverse('starred:home') in urls)
     ok_(reverse('new:home') in urls)
     ok_('/browserid/logout/' in urls)
 def test_signed_in_contributor(self):
     request = RequestFactory().get('/')
     request.user = User.objects.create(
         username='******'
     )
     UserProfile.objects.create(
         user=request.user,
         contributor=True,
     )
     data = nav_bar(request)['nav_bar']()
     eq_(data['unfinished_events'], 0)
     urls = [x[1] for x in data['items']]
     ok_('/' in urls)
     ok_('/about/' in urls)
     ok_(reverse('main:channels') in urls)
     ok_(reverse('main:calendar') in urls)
     ok_(reverse('main:tag_cloud') in urls)
     ok_(reverse('starred:home') in urls)
     ok_(reverse('new:home') in urls)
     ok_('/browserid/logout/' in urls)
    def test_signed_in_with_unfinished_events(self):
        request = RequestFactory().get('/')
        request.user = User.objects.create(
            username='******',
        )
        event = Event.objects.create(
            creator=request.user,
            status=Event.STATUS_INITIATED,
            start_time=timezone.now(),
        )
        upload = Upload.objects.create(
            user=request.user,
            url='https://aws.example.com/file.mov',
            size=123,
            mime_type='video/quicktime',
            event=event
        )
        event.upload = upload
        event.save()

        data = nav_bar(request)['nav_bar']()
        eq_(data['unfinished_events'], 1)
Esempio n. 20
0
    def test_signed_in_contributor(self):
        request = RequestFactory().get('/')
        request.user = User.objects.create(
            username='******'
        )
        UserProfile.objects.create(
            user=request.user,
            contributor=True,
        )
        data = nav_bar(request)['nav_bar']()
        urls = [x[1] for x in data['items']]
        all_sub_items = [x[-1] for x in data['items']]

        ok_('/' in urls)
        ok_('/about/' in urls)
        ok_(reverse('main:channels') in urls)
        ok_(reverse('main:calendar') in urls)
        ok_(reverse('main:tag_cloud') in urls)
        # ok_(reverse('starred:home') in urls)
        ok_(reverse('new:home') in urls)
        # under the second to last (new)
        sub_items = all_sub_items[-2]
        urls = [x[1] for x in sub_items]
        assert len(urls) == 4
        ok_(reverse('new:home') + 'record' in urls)
        ok_(reverse('new:home') + 'upload' in urls)
        ok_(reverse('new:home') + 'youtube' in urls)
        ok_(reverse('suggest:start') + '#new' in urls)
        # under the last (you) there should be some personal links too
        sub_items = all_sub_items[-1]
        urls = [x[1] for x in sub_items]
        assert len(urls) == 3
        ok_(reverse('starred:home') in urls)
        ok_(reverse('search:savedsearches') in urls)
        ok_(reverse('manage:events') not in urls)
        ok_('/browserid/logout/' in urls)