Exemplo n.º 1
0
 def test_primary_key(self):
     """should use configured primary_key in url"""
     TestModel.attributes("id", "foo")
     model = TestModel({"id": 7, "foo": 12345})
     self.config["primary_key"] = "foo"
     adapter = RestfulHttpAdapter(self.config, mode="read")
     url = adapter.url_for("GET", model)
     self.assertEqual(url, "/widgets/12345.xml")
Exemplo n.º 2
0
 def test_primary_key(self):
     """should use configured primary_key in url"""
     TestModel.id = Field()
     TestModel.foo = Field()
     model = TestModel({'id': 7, 'foo': 12345})
     self.config['primary_key'] = 'foo'
     adapter = RestfulHttpAdapter(self.config)
     url = adapter.url_for('GET', model)
     self.assertEqual(url, '/widgets/12345.xml')
 def test_primary_key(self):
     """should use configured primary_key in url"""
     TestModel.id = Field()
     TestModel.foo = Field()
     model = TestModel({'id':7, 'foo':12345})
     self.config['primary_key'] = 'foo'
     adapter = RestfulHttpAdapter(self.config)
     url = adapter.url_for('GET', model)
     self.assertEqual(url, '/widgets/12345.xml')
Exemplo n.º 4
0
 def test_missing_format(self):
     """should use 'json' as the default format"""
     del self.config["format"]
     adapter = RestfulHttpAdapter(self.config, mode="read")
     url = adapter.url_for("GET", self.model)
     self.assertEqual(url, "/widgets/7.json")
Exemplo n.º 5
0
 def test_missing_format(self):
     """should use 'json' as the default format"""
     del self.config['format']
     adapter = RestfulHttpAdapter(self.config)
     url = adapter.url_for('GET', self.model)
     self.assertEqual(url, '/widgets/7.json')
 def test_missing_format(self):
     """should use 'json' as the default format"""
     del self.config['format']
     adapter = RestfulHttpAdapter(self.config)
     url = adapter.url_for('GET', self.model)
     self.assertEqual(url, '/widgets/7.json')