Skip to content

Commit

Permalink
Starting migration of TwoLegged and ThreeLegged tests to unittest.Tes…
Browse files Browse the repository at this point in the history
…tCase
  • Loading branch information
diogobaeder committed May 27, 2012
1 parent 073ce4f commit 79c5fe3
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions yql/tests/test_requests_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,24 @@ def test_name_param_inserted_for_public_yql(self):
uri = y.execute(query, {"dog": "fifi"})
self.assertGreater(uri.find('dog=fifi'), -1)

@with_setup(set_up_http_from_file, tear_down_http_from_file)
def test_json_response_from_file(self):
query = 'SELECT * from foo WHERE dog=@dog'
y = yql.Public(httplib2_inst=httplib2.Http())
content = y.execute(query, {"dog": "fifi"})
self.assertEqual(content.count, 3)

@raises(TypeError)
def test_yql_with_2leg_auth_raises_typerror():
TestTwoLegged()

@raises(TypeError)
def test_yql_with_3leg_auth_raises_typerror():
TestThreeLegged()
class TwoLeggedTest(TestCase):
@raises(TypeError)
def test_yql_with_2leg_auth_raises_typerror(self):
TestTwoLegged()

@with_setup(set_up_http_from_file, tear_down_http_from_file)
def test_json_response_from_file():
query = 'SELECT * from foo WHERE dog=@dog'
y = yql.Public(httplib2_inst=httplib2.Http())
content = y.execute(query, {"dog": "fifi"})
assert content.count == 3

class ThreeLeggedTest(TestCase):
@raises(TypeError)
def test_yql_with_3leg_auth_raises_typerror():
TestThreeLegged()

def test_api_key_and_secret_attrs():
y = yql.TwoLegged('test-api-key', 'test-secret')
Expand Down

0 comments on commit 79c5fe3

Please sign in to comment.