def test_get_bound_href(self): action = SirenAction('action', 'blah', 'application/json') bound_href, request_fields = action._get_bound_href(TemplatedString, x=1, y=2) self.assertEqual(bound_href, 'blah') self.assertDictEqual(request_fields, dict(x=1, y=2))
def test_get_bound_href_with_template(self): action = SirenAction('action', 'http://host.com/{id}/{id}', 'application/json') bound_href, request_fields = action._get_bound_href(TemplatedString, x=1, y=2, id=3) self.assertEqual(bound_href, 'http://host.com/3/3') self.assertDictEqual(dict(x=1, y=2), request_fields)
def test_get_bound_href_with_template(self): action = SirenAction('action', 'http://host.com/{id}/{id}', 'application/json') bound_href, request_fields = action._get_bound_href(TemplatedString, x=1, y=2, id=3) self.assertEqual(bound_href, 'http://host.com/3/3') self.assertDictEqual(dict(x=1, y=2), request_fields)
def test_get_bound_href(self): action = SirenAction('action', 'blah', 'application/json') bound_href, request_fields = action._get_bound_href(TemplatedString, x=1, y=2) self.assertEqual(bound_href, 'blah') self.assertDictEqual(request_fields, dict(x=1, y=2))