Example #1
0
    def test_grant_deferred_award(self):
        """Deferred award for a badge can be granted to an email address."""
        deferred_email = "*****@*****.**"
        user1 = self._get_user(username="******", email="*****@*****.**")
        b1 = Badge.objects.create(creator=user1, title="Badge to defer")
        
        da = DeferredAward(badge=b1, creator=user1, email='*****@*****.**')
        da.save()
        url = da.get_claim_url()

        self.client.login(username="******", password="******")
        r = self.client.get(url, follow=True)
        eq_(200, r.status_code)

        doc = pq(r.content)
        form = doc('form#grant_award')
        eq_(1, form.length)
        eq_(1, form.find('*[name=email]').length)
        eq_(1, form.find('input.submit,button.submit').length)

        r = self.client.post(url, dict(
            is_grant=1, email=deferred_email,
        ), follow=False)

        user2 = self._get_user(username="******", email=deferred_email)
        self.client.login(username="******", password="******")
        r = self.client.get(reverse('badger.views.detail',
            args=(b1.slug,)), follow=True)
        ok_(b1.is_awarded_to(user2))
Example #2
0
    def test_channel_edit_child(self):
        channel = Channel.objects.get(slug='testing')
        response = self.client.get(
            reverse('manage:channel_edit', args=(channel.pk,)),
        )
        eq_(response.status_code, 200)
        choices = (
            response.content
            .split('name="parent"')[1]
            .split('</select>')[0]
        )
        ok_('Main' in choices)
        # you should not be able to self-reference
        ok_('Testing' not in choices)

        main = Channel.objects.get(slug='main')
        response = self.client.post(
            reverse('manage:channel_edit', args=(channel.pk,)),
            {
                'name': 'Different',
                'slug': 'different',
                'description': '<p>Other things</p>',
                'parent': main.pk,
                'feed_size': 10,
            }
        )
        eq_(response.status_code, 302)
        channel = Channel.objects.get(slug='different')
        eq_(channel.parent, main)

        # now expect two links to "Main" on the channels page
        response = self.client.get(reverse('manage:channels'))
        eq_(response.status_code, 200)
        view_url = reverse('main:home_channels', args=(main.slug,))
        eq_(response.content.count(view_url), 2)
    def test_signature_trend(self, rget):
        model = models.SignatureTrend
        api = model()

        def mocked_get(**options):
            assert 'topcrash/sig/trend' in options['url'], options['url']
            return Response("""
            {
              "signature": "Pickle::ReadBytes",
              "start_date": "2012-04-19T08:00:00+00:00",
              "end_date": "2012-05-31T00:00:00+00:00",
              "signatureHistory": []
            }
            """)

        rget.side_effect = mocked_get
        today = datetime.datetime.utcnow()
        r = api.get(
            product='Thunderbird',
            version='12.0',
            signature='Pickle::ReadBytes',
            end_date=today,
            duration=1000
        )
        ok_(r['signature'])
Example #4
0
    def test_http_method_not_allowed_allowed_methods(self):
        class GetPostView(views.JSONView):
            def get(self, request, *args, **kwargs):
                return 'asdf'

            def post(self, request, *args, **kwargs):
                return 'qwer'
        response = GetPostView().http_method_not_allowed()
        ok_(set(['GET', 'POST']).issubset(set(response['Allow'].split(', '))))

        class GetPostPutDeleteHeadView(views.JSONView):
            def get(self, request, *args, **kwargs):
                return 'asdf'

            def post(self, request, *args, **kwargs):
                return 'qwer'

            def put(self, request, *args, **kwargs):
                return 'qwer'

            def delete(self, request, *args, **kwargs):
                return 'qwer'

            def head(self, request, *args, **kwargs):
                return 'qwer'
        response = GetPostPutDeleteHeadView().http_method_not_allowed()
        expected_methods = set(['GET', 'POST', 'PUT', 'DELETE', 'HEAD'])
        actual_methods = set(response['Allow'].split(', '))
        ok_(expected_methods.issubset(actual_methods))
    def test_current_versions(self, rget):
        model = models.CurrentVersions
        api = model()

        def mocked_get(**options):
            assert '/products/' in options['url']
            return Response("""
                {"hits": {
                   "SeaMonkey": [{
                     "product": "SeaMonkey",
                     "throttle": "100.00",
                     "end_date": "2012-05-10 00:00:00",
                     "start_date": "2012-03-08 00:00:00",
                     "featured": true,
                     "version": "2.1.3pre",
                     "release": "Beta",
                     "id": 922}]
                  },
                  "products": ["SeaMonkey"]
                }
              """)

        rget.side_effect = mocked_get
        info = api.get()
        ok_(isinstance(info, list))
        ok_(isinstance(info[0], dict))
        eq_(info[0]['product'], 'SeaMonkey')
    def test_comments_by_signature(self, rget):
        model = models.CommentsBySignature
        api = model()

        def mocked_get(**options):
            assert 'crashes/comments' in options['url'], options['url']
            ok_('products/WaterWolf' in options['url'])
            ok_('versions/WaterWolf%3A19.0a1' in options['url'])
            ok_('build_ids/1234567890' in options['url'])
            ok_('reasons/SEG%252FFAULT' in options['url'])
            return Response("""
            {"hits": [
                  {
                  "date_processed": "2000-01-01T00:00:01",
                  "uuid": "1234abcd",
                  "user_comment": "hello guys!",
                  "email": "*****@*****.**"
                }],
              "total": 1
              }
            """)

        rget.side_effect = mocked_get
        r = api.get(
            signature='mysig',
            products=['WaterWolf'],
            versions=['WaterWolf:19.0a1'],
            build_ids='1234567890',
            reasons='SEG/FAULT'
        )
        ok_(r['hits'])
        ok_(r['total'])
 def mocked_get(url, **options):
     assert '/crash_data/' in url
     ok_('/datatype/processed/' in url)
     return Response("""
     {
       "product": "Firefox",
       "uuid": "7c44ade2-fdeb-4d6c-830a-07d302120525",
       "version": "13.0",
       "build": "20120501201020",
       "ReleaseChannel": "beta",
       "os_name": "Windows NT",
       "date_processed": "2012-05-25 11:35:57",
       "success": true,
       "signature": "CLocalEndpointEnumerator::OnMediaNotific",
       "addons": [
         [
           "*****@*****.**",
           "1.2.1"
         ],
         [
           "{972ce4c6-7e08-4474-a285-3208198ce6fd}",
           "13.0"
         ]
       ]
     }
     """)
Example #8
0
  def test_upload_cleanup(self):
    dpath = mkdtemp()
    _write = self.client.write

    def write(hdfs_path, *args, **kwargs):
      if 'bar' in hdfs_path:
        raise RuntimeError()
      return _write(hdfs_path, *args, **kwargs)

    try:
      self.client.write = write
      npath = osp.join(dpath, 'hi')
      os.mkdir(npath)
      with open(osp.join(npath, 'foo'), 'w') as writer:
        writer.write('hello!')
      os.mkdir(osp.join(npath, 'bar'))
      with open(osp.join(npath, 'bar', 'baz'), 'w') as writer:
        writer.write('world!')
      try:
        self.client.upload('foo', dpath)
      except RuntimeError:
        ok_(not self._exists('foo'))
      else:
        ok_(False) # This shouldn't happen.
    finally:
      rmtree(dpath)
      self.client.write = _write
Example #9
0
    def test_xss_file_attachment_title(self):
        title = '"><img src=x onerror=prompt(navigator.userAgent);>'
        # use view to create new attachment
        file_for_upload = make_test_file()
        post_data = {
            'title': title,
            'description': 'xss',
            'comment': 'xss',
            'file': file_for_upload,
        }
        self.client.login(username='******', password='******')
        resp = self.client.post(reverse('attachments.new_attachment'),
                                data=post_data)
        eq_(302, resp.status_code)

        # now stick it in/on a document
        attachment = Attachment.objects.get(title=title)
        rev = revision(content='<img src="%s" />' % attachment.get_file_url(),
                       save=True)

        # view it and verify markup is escaped
        response = self.client.get(rev.document.get_edit_url())
        eq_(200, response.status_code)
        doc = pq(response.content)
        eq_('%s xss' % title,
            doc('#page-attachments-table .attachment-name-cell').text())
        ok_('&gt;&lt;img src=x onerror=prompt(navigator.userAgent);&gt;' in
            doc('#page-attachments-table .attachment-name-cell').html())
Example #10
0
 def test_failed_login_keeps_username(self):
     """Wrong password keeps user_name in login form"""
     resp = self.app.get('/login_handler?login=manager&password=badpassword',
                         status=302)
     resp = resp.follow(status=200)
     ok_('Invalid Password' in resp, resp)
     eq_(resp.form['login'].value, 'manager')
Example #11
0
 def test_rename_file(self):
   paths = ['foo', '%s/bar' % (self.client.root.rstrip('/'), )]
   self.client._create(paths[0], data='hello')
   ok_(self.client._rename(paths[0], destination=paths[1]).json()['boolean'])
   ok_(not self._exists(paths[0]))
   eq_(self.client._open(paths[1].rsplit('/', 1)[1]).content, b'hello')
   self.client._delete(paths[1])
Example #12
0
    def test_amara_callback_successful(self):
        url = reverse('subtitles:amara_callback')
        event = Event.objects.get(title='Test event')
        amara_video = AmaraVideo.objects.create(
            event=event,
            video_id='abc123',
            video_url='http://example.com/foo.mp4',
        )

        response = self.post_json(url, {
            'event': 'new-language',
            'video_id': amara_video.video_id,
            'api_url': 'http://example.com/api/url',
            'team': 'myteam',
            'project': 'myproject',
            'language_code': 'sv',
        })
        eq_(response.status_code, 200)

        amara_callback = AmaraCallback.objects.get(
            api_url='http://example.com/api/url'
        )
        eq_(amara_callback.amara_video, amara_video)
        ok_(amara_callback.payload)
        eq_(amara_callback.api_url, 'http://example.com/api/url')
        eq_(amara_callback.team, 'myteam')
        eq_(amara_callback.project, 'myproject')
        eq_(amara_callback.language_code, 'sv')
Example #13
0
 def test_message_with_url_is_link(self):
     m = Message(message="Go to http://bit.ly/sample-demo", is_global=True,
                 is_active=True, url="/")
     m.save()
     ok_('Go to <a href="http://bit.ly/sample-demo">'
         'http://bit.ly/sample-demo</a>' in
         soapbox_messages(get_soapbox_messages("/")))
Example #14
0
def test_form_columns():
    app, db, admin = setup()

    class Model(db.Model):
        id = db.Column(db.String, primary_key=True)
        int_field = db.Column(db.Integer)
        datetime_field = db.Column(db.DateTime)
        text_field = db.Column(db.UnicodeText)
        excluded_column = db.Column(db.String)

    class ChildModel(db.Model):
        id = db.Column(db.String, primary_key=True)
        model_id = db.Column(db.Integer, db.ForeignKey(Model.id))
        model = db.relationship(Model, backref='backref')

    db.create_all()

    view1 = CustomModelView(Model, db.session, endpoint='view1',
                            form_columns=('int_field', 'text_field'))
    view2 = CustomModelView(Model, db.session, endpoint='view2',
                            form_excluded_columns=('excluded_column',))
    view3 = CustomModelView(ChildModel, db.session, endpoint='view3')

    form1 = view1.create_form()
    form2 = view2.create_form()
    form3 = view3.create_form()

    ok_('int_field' in form1._fields)
    ok_('text_field' in form1._fields)
    ok_('datetime_field' not in form1._fields)

    ok_('excluded_column' not in form2._fields)

    ok_(type(form3.model).__name__ == 'QuerySelectField')
Example #15
0
def test_on_model_change_delete():
    app, db, admin = setup()
    Model1, _ = create_models(db)
    db.create_all()

    class ModelView(CustomModelView):
        def on_model_change(self, form, model, is_created):
            model.test1 = model.test1.upper()

        def on_model_delete(self, model):
            self.deleted = True

    view = ModelView(Model1, db.session)
    admin.add_view(view)

    client = app.test_client()

    client.post('/admin/model1/new/',
                data=dict(test1='test1large', test2='test2'))

    model = db.session.query(Model1).first()
    eq_(model.test1, 'TEST1LARGE')

    url = '/admin/model1/edit/?id=%s' % model.id
    client.post(url, data=dict(test1='test1small', test2='test2large'))

    model = db.session.query(Model1).first()
    eq_(model.test1, 'TEST1SMALL')

    url = '/admin/model1/delete/?id=%s' % model.id
    client.post(url)
    ok_(view.deleted)
Example #16
0
 def test_strip_if_true(self):
     test_with_spaces = " T es t "
     test_without_spaces = "T es t"
     test_stripped = strip_if_true(test_with_spaces, True)
     test_not_stripped = strip_if_true(test_with_spaces, False)
     ok_(test_without_spaces == test_stripped)
     ok_(test_with_spaces == test_not_stripped)
Example #17
0
def test_non_int_pk():
    app, db, admin = setup()

    class Model(db.Model):
        id = db.Column(db.String, primary_key=True)
        test = db.Column(db.String)

    db.create_all()

    view = CustomModelView(Model, db.session, form_columns=['id', 'test'])
    admin.add_view(view)

    client = app.test_client()

    rv = client.get('/admin/model/')
    eq_(rv.status_code, 200)

    rv = client.post('/admin/model/new/',
                     data=dict(id='test1', test='test2'))
    eq_(rv.status_code, 302)

    rv = client.get('/admin/model/')
    eq_(rv.status_code, 200)
    data = rv.data.decode('utf-8')
    ok_('test1' in data)

    rv = client.get('/admin/model/edit/?id=test1')
    eq_(rv.status_code, 200)
    data = rv.data.decode('utf-8')
    ok_('test2' in data)
Example #18
0
    def test_multiple_delivery_with_multiple_ack(self):
        data = str(uuid.uuid4())
        data2 = str(uuid.uuid4())
        client = yield self.quick_register(use_webpush=True)
        yield client.disconnect()
        ok_(client.channels)
        yield client.send_notification(data=data)
        yield client.send_notification(data=data2)
        yield client.connect()
        yield client.hello()
        result = yield client.get_notification()
        ok_(result != {})
        ok_(result["data"] in map(urlsafe_b64encode, [data, data2]))
        result2 = yield client.get_notification()
        ok_(result2 != {})
        ok_(result2["data"] in map(urlsafe_b64encode, [data, data2]))
        yield client.ack(result2["channelID"], result2["version"])
        yield client.ack(result["channelID"], result["version"])

        yield client.disconnect()
        yield client.connect()
        yield client.hello()
        result = yield client.get_notification()
        eq_(result, None)
        yield self.shut_down(client)
Example #19
0
    def test_reads_legacy_boto_file(self):
        with open(self.creds_tempfile, 'w') as credentials:
            credentials.write("""[Credentials]
aws_access_key_id = itsme""")

        config = FileConfig()
        ok_(config._parser.has_option('Credentials', 'aws_access_key_id'))
Example #20
0
    def test_webpush_data_delivery_to_disconnected_client(self):
        tests = {
            "d248d4e0-0ef4-41d9-8db5-2533ad8e4041": dict(data=b"\xe2\x82\x28\xf0\x28\x8c\xbc", result="4oIo8CiMvA=="),
            "df2363be-4d55-49c5-a1e3-aeae9450692e": dict(
                data=b"\xf0\x90\x28\xbc\xf0\x28\x8c\x28", result="8JAovPAojCg="
            ),
            "6c33e055-5762-47e5-b90c-90ad9bfe3f53": dict(data=b"\xc3\x28\xa0\xa1\xe2\x28\xa1", result="wyigoeIooQ=="),
        }

        client = Client("ws://localhost:9010/", use_webpush=True)
        yield client.connect()
        yield client.hello()
        for chan, test in tests.items():
            yield client.register(chid=chan)

        yield client.disconnect()
        for chan, test in tests.items():
            yield client.send_notification(channel=chan, data=test["data"])

        yield client.connect()
        yield client.hello()

        for chan in tests:
            result = yield client.get_notification()
            ok_(result is not None)
            chan = result["channelID"]
            test = tests[chan]
            eq_(result["data"], test["result"])
            yield client.ack(chan, result["version"])

        yield self.shut_down(client)
Example #21
0
 def test_hello_echo(self):
     client = Client(self._ws_url, use_webpush=True)
     yield client.connect()
     result = yield client.hello()
     ok_(result != {})
     eq_(result["use_webpush"], True)
     yield self.shut_down(client)
Example #22
0
def test_model():
    app, db, admin = setup()

    view = TestView(db.test, 'Test')
    admin.add_view(view)

    # Drop existing data (if any)
    db.test.remove()

    eq_(view.name, 'Test')
    eq_(view.endpoint, 'testview')

    ok_('test1' in view._sortable_columns)
    ok_('test2' in view._sortable_columns)

    ok_(view._create_form_class is not None)
    ok_(view._edit_form_class is not None)
    eq_(view._search_supported, False)
    eq_(view._filters, None)

    # Make some test clients
    client = app.test_client()

    rv = client.get('/admin/testview/')
    eq_(rv.status_code, 200)

    rv = client.get('/admin/testview/new/')
    eq_(rv.status_code, 200)

    rv = client.post('/admin/testview/new/',
                     data=dict(test1='test1large', test2='test2'))
    eq_(rv.status_code, 302)

    model = db.test.find()[0]
    print(model)
    eq_(model['test1'], 'test1large')
    eq_(model['test2'], 'test2')

    rv = client.get('/admin/testview/')
    eq_(rv.status_code, 200)
    ok_('test1large' in rv.data.decode('utf-8'))

    url = '/admin/testview/edit/?id=%s' % model['_id']
    rv = client.get(url)
    eq_(rv.status_code, 200)

    rv = client.post(url,
                     data=dict(test1='test1small', test2='test2large'))
    eq_(rv.status_code, 302)

    print(db.test.find()[0])

    model = db.test.find()[0]
    eq_(model['test1'], 'test1small')
    eq_(model['test2'], 'test2large')

    url = '/admin/testview/delete/?id=%s' % model['_id']
    rv = client.post(url)
    eq_(rv.status_code, 302)
    eq_(db.test.count(), 0)
Example #23
0
 def test_get_jwt(self, client=None, extra_headers=None):
     res = self._post(client=client, extra_headers=extra_headers)
     eq_(res.status_code, 201, res.content)
     contribution = Contribution.objects.get()
     eq_(res.json['contribStatusURL'],
         reverse('webpay-status', kwargs={'uuid': contribution.uuid}))
     ok_(res.json['webpayJWT'])
Example #24
0
    def test_title(self):
        event = SuggestedEvent.objects.create(
            user=self.user,
            title='Cool Title',
            slug='cool-title',
        )
        url = reverse('suggest:title', args=(event.pk,))
        response = self.client.get(url)
        eq_(response.status_code, 200)

        data = {
            'title': '',
            'slug': 'contains spaces',
        }
        response = self.client.post(url, data)
        eq_(response.status_code, 200)
        ok_('Form errors' in response.content)

        data = {
            'title': 'New Title',
            'slug': 'new-slug',
        }
        response = self.client.post(url, data)
        eq_(response.status_code, 302)
        next_url = reverse('suggest:description', args=(event.pk,))
        self.assertRedirects(response, next_url)
Example #25
0
 def test_details_timezone_formatting(self):
     location = Location.objects.create(
         name='Paris',
         timezone='Europe/Paris'
     )
     start_time = datetime.datetime(
         2013, 5, 6, 11, 0, 0
     ).replace(tzinfo=utc)
     event = SuggestedEvent.objects.create(
         user=self.user,
         title='Cool Title',
         slug='cool-title',
         description='Some long description',
         short_description='',
         location=location,
         privacy=Event.PRIVACY_PUBLIC,
         start_time=start_time,
     )
     url = reverse('suggest:details', args=(event.pk,))
     response = self.client.get(url)
     eq_(response.status_code, 200)
     # the location is `US/Pacific` which means at 13:00 UTC,
     # the time is expected to be 05:00 in US/Pacific
     as_string = '2013-05-06 13:00:00'
     ok_('value="%s"' % as_string in response.content)
Example #26
0
    def test_send_mail(self, fake_messages):
        """Test EmailRepsForm email sending functionality."""

        data = {"subject": "Test email subject", "body": "Test email body", "functional_area": self.functional_area.id}

        form = EmailRepsForm(data=data)
        ok_(form.is_valid())

        area = self.functional_area
        UserFactory.create_batch(20, userprofile__functional_areas=[area])

        factory = RequestFactory()
        request = factory.request()
        request.user = UserFactory.create()

        reps = User.objects.filter(userprofile__functional_areas__name=area)

        form.send_email(request, reps)

        eq_(len(mail.outbox), 20)

        address = lambda u: "%s %s <%s>" % (u.first_name, u.last_name, u.email)
        recipients = map(address, reps)

        receivers = []
        for i in range(0, len(mail.outbox)):
            eq_(mail.outbox[i].subject, data["subject"])
            eq_(mail.outbox[i].body, data["body"])
            receivers.append(mail.outbox[i].to[0])

        eq_(set(receivers), set(recipients))
        fake_messages.assert_called_with(ANY, "Email sent successfully.")
Example #27
0
 def test_link_to_suggest(self):
     event = Event.objects.get(title='Test event')
     self._attach_file(event, self.placeholder)
     response = self.client.get('/')
     eq_(response.status_code, 200)
     start_url = reverse('suggest:start')
     ok_(start_url in response.content)
Example #28
0
    def test_saves_promo_img(self, requests_mock, crush_mock):
        img_path = os.path.join(settings.ROOT, 'mkt', 'site', 'tests',
                                'images', 'game_1050.jpg')

        # Mock the image fetch request.
        with open(img_path, 'r') as content:
            requests_mock.return_value = mock.Mock(
                content=content.read(),
                headers={'ok': 'ok'},
                status_code=200)

        result = fetch_promo_imgs(self.website.pk, 'http://mocked_url.ly')
        ok_(result)

        website = Website.objects.all()[0]
        eq_(website.promo_img_hash, '215dd2a2')

        # Check the actual saved image on disk.
        img_dir = website.get_promo_img_dir()
        for size in mkt.PROMO_IMG_SIZES:
            img_path = os.path.join(img_dir, '%s-%s.png' % (str(website.id),
                                                            size))
            with public_storage.open(img_path, 'r') as img:
                checker = ImageCheck(img)
                assert checker.is_image()
                eq_(checker.img.size[0], size)
 def test_register_without_code_vouched(self):
     user = UserFactory.create()
     with self.login(user) as client:
         response = client.get(reverse('phonebook:register'), follow=True)
     ok_(not self.client.session.get('invite-code'))
     self.assertJinja2TemplateUsed(response, 'phonebook/home.html')
     eq_(response.status_code, 200)
    def test_index(self):
        """Integration-test ``index()`` with some decorator-handled arg."""
        def valid_responder(*args, **kwargs):
            """Return an arbitrary successful Response."""
            response = requests.Response()
            response._content = six.b('{"some": "json"}')
            response.status_code = 200
            return response

        conn = ElasticSearch('http://example.com:9200/')
        with patch.object(conn.session, 'put') as put:
            put.side_effect = valid_responder
            conn.index('some_index',
                       'some_type',
                       {'some': 'doc'},
                       id=3,
                       routing='boogie',
                       es_snorkfest=True,
                       es_borkfest='gerbils:great')

        # Make sure all the query string params got into the URL:
        url = put.call_args[0][0]
        ok_(
            url.startswith('http://example.com:9200/some_index/some_type/3?'))
        ok_('routing=boogie' in url)
        ok_('snorkfest=true' in url)
        ok_('borkfest=gerbils%3Agreat' in url)
        ok_('es_' not in url)  # We stripped the "es_" prefixes.
Example #31
0
 def ToUnicode_Py2Bytes_test():
     value = utils.ToUnicode(bytes('abc'))
     eq_(value, u'abc')
     ok_(isinstance(value, str))
Example #32
0
 def test_scan(self):
     # TODO mock a successful scan
     devices = self.backend.scan()
     ok_(devices is not None)
     eq_(0, len(devices))
Example #33
0
    def test_topcrashers(self, rpost, bugs_get):

        def mocked_bugs(**options):
            return {
                "hits": [
                    {"id": 123456789,
                     "signature": "Something"},
                    {"id": 22222,
                     "signature": u"FakeSignature1 \u7684 Japanese"},
                    {"id": 33333,
                     "signature": u"FakeSignature1 \u7684 Japanese"}
                ]
            }
        bugs_get.side_effect = mocked_bugs

        def mocked_sigs(url, **options):
            if 'signature/first_date' in url:
                return Response({
                    "hits": [
                        {
                            "signature": u"FakeSignature1 \u7684 Japanese",
                            "first_date": "2000-01-01T12:23:34",
                            "first_build": "20000101122334",
                        },
                    ],
                    "total": 1
                })
            raise NotImplementedError(url)
        rpost.side_effect = mocked_sigs

        def mocked_supersearch_get(**params):
            if '_columns' not in params:
                params['_columns'] = []

            if 'hang_type' not in params['_aggs.signature']:
                # Return results for the previous week.
                results = {
                    'hits': [],
                    'facets': {
                        'signature': [{
                            'term': u'FakeSignature1 \u7684 Japanese',
                            'count': 100,
                            'facets': {
                                'platform': [{
                                    'term': 'WaterWolf',
                                    'count': 50,
                                }],
                                'is_garbage_collecting': [{
                                    'term': 't',
                                    'count': 50,
                                }],
                                'hang_type': [{
                                    'term': 1,
                                    'count': 50,
                                }],
                                'process_type': [{
                                    'term': 'plugin',
                                    'count': 50,
                                }],
                                'histogram_uptime': [{
                                    'term': 0,
                                    'count': 40,
                                }],
                            }
                        }]
                    },
                    'total': 250
                }
            else:
                # Return results for the current week.
                results = {
                    'hits': [],
                    'facets': {
                        'signature': [{
                            'term': u'FakeSignature1 \u7684 Japanese',
                            'count': 100,
                            'facets': {
                                'platform': [{
                                    'term': 'WaterWolf',
                                    'count': 50,
                                }],
                                'is_garbage_collecting': [{
                                    'term': 't',
                                    'count': 50,
                                }],
                                'hang_type': [{
                                    'term': 1,
                                    'count': 50,
                                }],
                                'process_type': [{
                                    'term': 'plugin',
                                    'count': 50,
                                }],
                                'histogram_uptime': [{
                                    'term': 0,
                                    'count': 60,
                                }],
                            }
                        }, {
                            'term': u'mozCool()',
                            'count': 80,
                            'facets': {
                                'platform': [{
                                    'term': 'WaterWolf',
                                    'count': 50,
                                }],
                                'is_garbage_collecting': [{
                                    'term': 't',
                                    'count': 50,
                                }],
                                'hang_type': [{
                                    'term': 1,
                                    'count': 50,
                                }],
                                'process_type': [{
                                    'term': 'browser',
                                    'count': 50,
                                }],
                                'histogram_uptime': [{
                                    'term': 0,
                                    'count': 40,
                                }],
                            }
                        }]
                    },
                    'total': 250
                }

            results['hits'] = self.only_certain_columns(
                results['hits'],
                params['_columns']
            )
            return results
        SuperSearch.implementation().get.side_effect = mocked_supersearch_get

        url = self.base_url + '?product=WaterWolf&version=19.0'

        response = self.client.get(self.base_url, {'product': 'WaterWolf'})
        ok_(url in response['Location'])

        # Test that several versions do not raise an error.
        response = self.client.get(self.base_url, {
            'product': 'WaterWolf',
            'version': '19.0;20.0',
        })
        eq_(response.status_code, 200)

        response = self.client.get(self.base_url, {
            'product': 'WaterWolf',
            'version': '19.0',
        })
        eq_(response.status_code, 200)
        doc = pyquery.PyQuery(response.content)
        selected_count = doc('.tc-result-count a[class="selected"]')
        eq_(selected_count.text(), '50')

        # there's actually only one such TD
        bug_ids = [x.text for x in doc('td.bug_ids_more > a')]
        # higher bug number first
        eq_(bug_ids, ['33333', '22222'])

        # Check the first appearance date is there.
        ok_('2000-01-01 12:23:34' in response.content)

        response = self.client.get(self.base_url, {
            'product': 'WaterWolf',
            'version': '19.0',
            '_facets_size': '100',
        })
        eq_(response.status_code, 200)
        doc = pyquery.PyQuery(response.content)
        selected_count = doc('.tc-result-count a[class="selected"]')
        eq_(selected_count.text(), '100')

        # Check the startup crash icon is there.
        ok_('Startup Crash' in response.content)
Example #34
0
    def test_action_predicate_accept(self):
        """test all of the case where the predicate should return True"""
        filter_rule = DontConsiderTheseFilter()

        fake_processor = create_basic_fake_processor()

        # find non-plugin crashes
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '0'
        test_raw_dumps = {}
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            DotDict(),
            fake_processor
        ))

        # find non-Firefox crashes
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Internet Explorer"
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            DotDict(),
            fake_processor
        ))

        # find crashes with no Version info
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            DotDict(),
            fake_processor
        ))

        # find crashes with faulty Version info
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = 'dwight'
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            DotDict(),
            fake_processor
        ))

        # find crashes with no BuildID info
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '17.1'
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            DotDict(),
            fake_processor
        ))

        # find crashes with faulty BuildID info
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '17.1'
        test_raw_crash.BuildID = '201307E2'
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            DotDict(),
            fake_processor
        ))

        # find crashes with faulty BuildID info (not integer)
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '17.1'
        test_raw_crash.BuildID = '201307E2'
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            DotDict(),
            fake_processor
        ))

        # find crashes with faulty BuildID info (bad month & day)
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '17.1'
        test_raw_crash.BuildID = '20131458'
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            DotDict(),
            fake_processor
        ))

        # find crashes with pre-17 version
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '15'
        test_raw_crash.BuildID = '20121015'
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            DotDict(),
            fake_processor
        ))

        # find crashes with 18 version but build date less than 2012-10-23
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '18'
        test_raw_crash.BuildID = '20121015'
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            DotDict(),
            fake_processor
        ))

        # find crashes with build date less than 2012-10-17
        # and version 17 or above
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '17'
        test_raw_crash.BuildID = '20121015'
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            DotDict(),
            fake_processor
        ))

        # find crashes with no default dump
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))

        # find crashes with no architecture info
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        test_processed_crash.dump = 'fake dump'
        test_processed_crash.json_dump = DotDict()
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))

        # find crashes with amd64 architecture info
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        test_processed_crash.dump = 'fake dump'
        test_processed_crash.json_dump = DotDict()
        test_processed_crash.json_dump.system_info = DotDict()
        test_processed_crash.json_dump.cpu_arch = 'amd64'
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))

        # find crashes with main dump processing errors
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        test_processed_crash.dump = 'fake dump'
        test_processed_crash.json_dump = DotDict()
        test_processed_crash.json_dump.system_info = DotDict()
        test_processed_crash.json_dump.system_info.cpu_arch = 'x86'
        test_processed_crash.success = False
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))

        # find crashes with extra dump processing errors
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        test_processed_crash.dump = 'fake dump'
        test_processed_crash.json_dump = DotDict()
        test_processed_crash.json_dump.system_info = DotDict()
        test_processed_crash.json_dump.system_info.cpu_arch = 'x86'
        test_processed_crash.success = True
        test_processed_crash.additional_minidumps = ['a', 'b', 'c']
        test_processed_crash.a = DotDict()
        test_processed_crash.a.success = True
        test_processed_crash.b = DotDict()
        test_processed_crash.b.success = True
        test_processed_crash.c = DotDict()
        test_processed_crash.c.success = False
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))

        # find crashes with missing critical attribute
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        test_processed_crash.dump = 'fake dump'
        test_processed_crash.json_dump = DotDict()
        test_processed_crash.json_dump.system_info = DotDict()
        test_processed_crash.json_dump.system_info.cpu_arch = 'x86'
        test_processed_crash.success = True
        test_processed_crash.additional_minidumps = ['a', 'b', 'c']
        test_processed_crash.a = DotDict()
        test_processed_crash.a.success = True
        test_processed_crash.b = DotDict()
        test_processed_crash.b.success = True
        test_processed_crash.c = DotDict()
        test_processed_crash.c.success = False
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))

        # find crashes with missing critical attribute
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        test_processed_crash.dump = 'fake dump'
        test_processed_crash.json_dump = DotDict()
        test_processed_crash.json_dump.system_info = DotDict()
        test_processed_crash.json_dump.system_info.cpu_arch = 'x86'
        test_processed_crash.success = True
        test_processed_crash.additional_minidumps = ['a', 'b', 'c']
        test_processed_crash.a = DotDict()
        test_processed_crash.a.success = True
        test_processed_crash.b = DotDict()
        test_processed_crash.b.success = True
        test_processed_crash.c = DotDict()
        test_processed_crash.c.success = False
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))

        # reject the perfect crash
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        test_processed_crash.dump = 'fake dump'
        test_processed_crash.json_dump = DotDict()
        test_processed_crash.json_dump.system_info = DotDict()
        test_processed_crash.json_dump.system_info.cpu_arch = 'x86'
        test_processed_crash.success = True
        test_processed_crash.additional_minidumps = ['a', 'b', 'c']
        test_processed_crash.a = DotDict()
        test_processed_crash.a.success = True
        test_processed_crash.b = DotDict()
        test_processed_crash.b.success = True
        test_processed_crash.c = DotDict()
        test_processed_crash.c.success = True
        ok_(not filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))

        # test the do-nothing action
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        test_processed_crash.dump = 'fake dump'
        test_processed_crash.json_dump = DotDict()
        test_processed_crash.json_dump.system_info = DotDict()
        test_processed_crash.json_dump.system_info.cpu_arch = 'x86'
        test_processed_crash.success = True
        test_processed_crash.additional_minidumps = ['a', 'b', 'c']
        test_processed_crash.a = DotDict()
        test_processed_crash.a.success = True
        test_processed_crash.b = DotDict()
        test_processed_crash.b.success = True
        test_processed_crash.c = DotDict()
        test_processed_crash.c.success = True
        ok_(filter_rule.action(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))
Example #35
0
def PathToNearestThirdPartyFolder_Failure_test():
  ok_( not PathToNearestThirdPartyFolder( os.path.expanduser( '~' ) ) )
Example #36
0
def PathToNearestThirdPartyFolder_Success_test():
  ok_( PathToNearestThirdPartyFolder( os.path.abspath( __file__ ) ) )
Example #37
0
 def ToUnicode_Py2Str_test():
     value = utils.ToUnicode('abc')
     eq_(value, u'abc')
     ok_(isinstance(value, str))
Example #38
0
def OnTravis_IsOnTravis_test():
    ok_(utils.OnTravis())
Example #39
0
def PathToFirstExistingExecutable_Basic_test():
    if utils.OnWindows():
        ok_(utils.PathToFirstExistingExecutable(['notepad.exe']))
    else:
        ok_(utils.PathToFirstExistingExecutable(['cat']))
Example #40
0
def OnTravis_IsNotOnTravis_test():
    ok_(not utils.OnTravis())
Example #41
0
def RemoveIfExists_Exists_test():
    tempfile = PathToTestFile('remove-if-exists')
    open(tempfile, 'a').close()
    ok_(os.path.exists(tempfile))
    utils.RemoveIfExists(tempfile)
    ok_(not os.path.exists(tempfile))
Example #42
0
def PathToFirstExistingExecutable_Failure_test():
    ok_(not utils.PathToFirstExistingExecutable(['ycmd-foobar']))
Example #43
0
def ToCppStringCompatible_Str_test():
    value = utils.ToCppStringCompatible('abc')
    eq_(value, bytes(b'abc'))
    ok_(isinstance(value, bytes))
Example #44
0
def RemoveIfExists_DoesntExist_test():
    tempfile = PathToTestFile('remove-if-exists')
    ok_(not os.path.exists(tempfile))
    utils.RemoveIfExists(tempfile)
    ok_(not os.path.exists(tempfile))
Example #45
0
def ToUnicode_Int_test():
    value = utils.ToUnicode(123)
    eq_(value, u'123')
    ok_(isinstance(value, str))
Example #46
0
def ToCppStringCompatible_Int_test():
    value = utils.ToCppStringCompatible(123)
    eq_(value, bytes(b'123'))
    ok_(isinstance(value, bytes))
Example #47
0
def test_figure_naming():
    pretitle, posttitle, prefile, postfile = figure_naming(pretitle='Test', posttitle=None, prefile="", postfile=3)
    nt.ok_(pretitle == 'Test -- ')
    nt.ok_(posttitle == "")
    nt.ok_(prefile == "")
    nt.ok_(postfile == "_3")
    pretitle, posttitle, prefile, postfile = figure_naming(pretitle='', posttitle="Test", prefile="test", postfile="")
    nt.ok_(pretitle == "")
    nt.ok_(posttitle == " -- Test")
    nt.ok_(prefile == "test_")
    nt.ok_(postfile == "")
Example #48
0
def ToUnicode_None_test():
    value = utils.ToUnicode(None)
    eq_(value, u'')
    ok_(isinstance(value, str))
Example #49
0
def test_get_color():
    nt.ok_(get_color(None, NeuriteType.basal_dendrite) == "red")
    nt.ok_(get_color(None, NeuriteType.axon) == "blue")
    nt.ok_(get_color(None, NeuriteType.apical_dendrite) == "purple")
    nt.ok_(get_color(None, NeuriteType.soma) == "black")
    nt.ok_(get_color(None, NeuriteType.undefined) == "green")
    nt.ok_(get_color(None, 'wrong') == "green")
    nt.ok_(get_color('blue', 'wrong') == "blue")
    nt.ok_(get_color('yellow', NeuriteType.axon) == "yellow")
Example #50
0
def test_get_figure():
    fig_old = plt.figure()
    fig, ax = get_figure(new_fig=False, subplot=False)
    nt.ok_(fig == fig_old)
    nt.ok_(ax.colNum == 0)
    nt.ok_(ax.rowNum == 0)
    fig1, ax1 = get_figure(new_fig=True, subplot=224)
    nt.ok_(fig1 != fig_old)
    nt.ok_(ax1.colNum == 1)
    nt.ok_(ax1.rowNum == 1)
    fig = get_figure(new_fig=True, no_axes=True)
    nt.ok_(type(fig) == plt.Figure)
    fig2, ax2 = get_figure(new_fig=True, subplot=[1,1,1])
    nt.ok_(ax2.colNum == 0)
    nt.ok_(ax2.rowNum == 0)
    plt.close('all')
    fig = plt.figure()
    ax  = fig.add_subplot(111)
    fig2, ax2 = get_figure(new_fig=False, new_axes=False)
    nt.ok_(fig2 == plt.gcf())
    nt.ok_(ax2 == plt.gca())
    plt.close('all')
Example #51
0
def test_plot_ticks():
    fig1, ax1 = plot_ticks(fig, ax)
    nt.ok_(len(ax1.get_xticks()) != 0 )
    nt.ok_(len(ax1.get_yticks()) != 0 )
    fig1, ax1 = plot_ticks(fig, ax, xticks=[], yticks=[])
    nt.ok_(len(ax1.get_xticks()) == 0 )
    nt.ok_(len(ax1.get_yticks()) == 0 )
    fig1, ax1 = plot_ticks(fig, ax, xticks=np.arange(3), yticks=np.arange(4))
    nt.ok_(len(ax1.get_xticks()) == 3 )
    nt.ok_(len(ax1.get_yticks()) == 4 )
    fig2, ax2 = plot_ticks(fig0, ax0)
    nt.ok_(len(ax2.get_zticks()) != 0 )
    fig2, ax2 = plot_ticks(fig0, ax0, zticks=[])
    nt.ok_(len(ax2.get_zticks()) == 0 )
    fig2, ax2 = plot_ticks(fig0, ax0, zticks=np.arange(3))
    nt.ok_(len(ax2.get_zticks()) == 3 )
Example #52
0
def test_plot_sphere():
    fig0, ax0 = get_figure(params={'projection':'3d'})
    fig1, ax1 = plot_sphere(fig0, ax0, [0,0,0], 10., color='black', alpha=1.)
    nt.ok_(ax1.has_data() == True)
Example #53
0
def test_plot_labels():
    fig1, ax1 = plot_labels(fig, ax)
    nt.ok_(ax1.get_xlabel() == 'X')
    nt.ok_(ax1.get_ylabel() == 'Y')
    fig1, ax1 = plot_labels(fig, ax, xlabel='T', ylabel='R')
    nt.ok_(ax1.get_xlabel() == 'T')
    nt.ok_(ax1.get_ylabel() == 'R')
    fig2, ax2 = plot_labels(fig0, ax0)
    nt.ok_(ax2.get_zlabel() == 'Z')
    fig2, ax2 = plot_labels(fig0, ax0, zlabel='T')
    nt.ok_(ax2.get_zlabel() == 'T')
Example #54
0
def test_plot_style():
    fig1, ax1 = plot_style(fig, ax)
    nt.ok_(ax1.get_title() == 'Figure')
    nt.ok_(ax1.get_xlabel() == 'X')
    nt.ok_(ax1.get_ylabel() == 'Y')
    fig1, ax1 = plot_style(fig, ax, no_axes=True)
    nt.ok_(ax1.get_frame_on() == False)
    nt.ok_(ax1.xaxis.get_visible() == False)
    nt.ok_(ax1.yaxis.get_visible() == False)
    fig1, ax1 = plot_style(fig, ax, tight=True)
    nt.ok_(fig1.get_tight_layout() == True)
    fig1, ax1 = plot_style(fig, ax, show_plot=False)
    nt.ok_(fig1 is None)
    nt.ok_(ax1 is None)
    if os.path.isdir(fig_dir):
        for data in os.listdir(fig_dir):
            os.remove(fig_dir + data)
        os.rmdir(fig_dir)
    fig1, ax1 = plot_style(fig, ax, output_path=fig_dir, output_name='Figure')
    nt.ok_(os.path.isfile(fig_dir + fig_name)==True)
    os.remove(fig_dir + fig_name)
    os.rmdir(fig_dir)
Example #55
0
 def test_secc_with_manager(self):
     """The manager can access the secure controller"""
     # Note how authentication is forged:
     environ = {'REMOTE_USER': '******'}
     resp = self.app.get('/secc', extra_environ=environ, status=200)
     ok_('Secure Controller here' in resp.text, resp.text)
Example #56
0
def test_plot_limits():
    fig1, ax1 = plot_limits(fig, ax)
    nt.ok_(ax1.get_xlim() == xlim)
    nt.ok_(ax1.get_ylim() == ylim)
    fig1, ax1 = plot_limits(fig, ax, xlim=(0,100), ylim=(-100,0))
    nt.ok_(ax1.get_xlim() == (0,100))
    nt.ok_(ax1.get_ylim() == (-100,0))
    fig2, ax2 = plot_limits(fig0, ax0)
    nt.ok_(np.allclose(ax2.get_zlim(), zlim0))
    fig2, ax2 = plot_limits(fig0, ax0, zlim=(0,100))
    nt.ok_(np.allclose(ax2.get_zlim(), (0,100)))
Example #57
0
 def test_index(self):
     """The front page is working properly"""
     response = self.app.get('/')
     msg = 'This simple app was made as a challenge for Axant!'
     # You can look for specific strings:
     ok_(msg in response)
Example #58
0
def test_plot_title():
    fig1, ax1 = plot_title(fig, ax)
    nt.ok_(ax1.get_title() == 'Figure')
    fig1, ax1 = plot_title(fig, ax, title='Test')
    nt.ok_(ax1.get_title() == 'Test')
Example #59
0
 def test_lbheartbeat(self):
     response = self.client.get('/__lbheartbeat__')
     eq_(response.status_code, 200)
     ok_(not response.data)
Example #60
0
 def test_environ(self):
     """Displaying the wsgi environ works"""
     response = self.app.get('/environ')
     ok_('The keys in the environment are:' in response)