def test_simple(self): spore = new_from_spec(spec) spore.enable('format.Json') resp = spore.get_user_info(username='******') content = resp.content # print content self.assertEqual(content['name'], 'franck')
# -*- coding: utf-8 -*- import spyre spec_filepath = '../server/lord_of_the_ring.json' frodon_client = spyre.new_from_spec( spec_filepath, base_url="http://localhost:5000") # activation du middleware de Basic Auth frodon_client.enable('auth.Basic', username="******", password="******") # activation du middleware json frodon_client.enable('format.Json') response = frodon_client.get_ring(id="9", format="json") # code de retour de la réponse -> 200 assert(response.status==200) # url générée avant envoi de la requête assert(response.base=='http://localhost:5000/rings/9.json') # contenu de la réponse expect_content = { "owner": "Dark Lord", "message": "One Ring to rule them all, One Ring to find them \ One Ring to bring them all and in the darkness bind them",
def test_simple(self): base_url = 'http://github.com/api/v2/' spore = new_from_spec(spec, base_url) spore.enable('runtime.runtime') res = spore.get_user_info(username='******') self.assertTrue(res)
def setUp(self): self.fake_server = {'/test': expected_response} self.client = spyre.new_from_spec(spec, base_url='http://localhost') self.username = '******' self.password = '******'