Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Commit

Permalink
Change some ok_'s to eq_'s in testing.
Browse files Browse the repository at this point in the history
ok_ is being used in some places where eq_ was intended.

Also, change test_some_bytes_visible in test_binary_files.py to drop the test
checking that we 404 on a /source/ page for binary files - we're now supporting
that scenario (and haven't been 404ing in any case, at least not in the recent
past).
  • Loading branch information
kleintom committed Apr 18, 2016
1 parent 0847d32 commit 1ab437d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions tests/test_binary_files/test_binary_files.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dxr.testing import DxrInstanceTestCase
from nose.tools import ok_
from nose.tools import ok_, eq_

class BinaryFileTests(DxrInstanceTestCase):
"""Tests that we show something for binary files like images."""
Expand All @@ -9,21 +9,21 @@ def test_png(self):
response = self.client().get('/code/source/red_circle.png')
ok_('src="/code/raw/red_circle.png"' in response.data)
response = self.client().get('/code/raw/red_circle.png')
ok_(response.status_code, 200)
eq_(response.status_code, 200)

def test_jpeg(self):
"""Make sure we show a preview of the jpeg."""
response = self.client().get('/code/source/small_blue_circle.jpeg')
ok_('src="/code/raw/small_blue_circle.jpeg"' in response.data)
response = self.client().get('/code/raw/small_blue_circle.jpeg')
ok_(response.status_code, 200)
eq_(response.status_code, 200)

def test_jpg(self):
"""Make sure we show a preview of the jpg."""
response = self.client().get('/code/source/Green circle.jpg')
ok_('src="/code/raw/Green%20circle.jpg"' in response.data)
response = self.client().get('/code/raw/Green circle.jpg')
ok_(response.status_code, 200)
eq_(response.status_code, 200)

def test_too_fat(self):
"""Make sure we don't show the preview icon for a file that's too big."""
Expand All @@ -35,14 +35,13 @@ def test_svg(self):
response = self.client().get('/code/source/yellow_circle.svg')
ok_('href="/code/raw/yellow_circle.svg"' in response.data)
response = self.client().get('/code/raw/yellow_circle.svg')
ok_(response.status_code, 200)
eq_(response.status_code, 200)

def test_some_bytes_visible(self):
"""We want some_bytes to show in the folder index, but without its own page."""
"""We want some_bytes to show in the folder index, but not be clickable."""
response = self.client().get('/code/source/')
ok_('some_bytes' in response.data)
response = self.client().get('/code/source/some_bytes')
ok_(response.status_code, 404)
ok_('href="/code/source/some_bytes"' not in response.data)

def test_some_bytes_not_searchable(self):
"""We want some_bytes to show on search page, but not be clickable."""
Expand Down
4 changes: 2 additions & 2 deletions tests/test_vcs_hg/test_vcs_hg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dxr.testing import DxrInstanceTestCaseMakeFirst

from nose import SkipTest
from nose.tools import ok_
from nose.tools import ok_, eq_


class MercurialTests(DxrInstanceTestCaseMakeFirst):
Expand Down Expand Up @@ -46,4 +46,4 @@ def test_permalink(self):
response = self.client().get('/code/source/Colon: name')
ok_('/rev/84798105c9ab5897f8c7d630d133d9003b44a62f/Colon:%20name" title="Permalink" class="permalink icon">Permalink</a>' in response.data)
response = self.client().get('/code/rev/84798105c9ab5897f8c7d630d133d9003b44a62f/Colon: name')
ok_(response.status_code, 200)
eq_(response.status_code, 200)

0 comments on commit 1ab437d

Please sign in to comment.