Permalink
Browse files

test for userAgent

  • Loading branch information...
1 parent 9a2ff27 commit 6bdab5f56e1e8dcf120f23e284e6627ac7567379 @TioBorracho TioBorracho committed Sep 29, 2012
Showing with 17 additions and 0 deletions.
  1. +7 −0 mockapi/app.js
  2. +10 −0 src/test/java/com/mercadolibre/sdk/MeliTest.java
View
@@ -97,6 +97,13 @@ app.delete('/items/123', function(req, res) {
}
});
+app.get('/echo/user_agent',function(req,res) {
+ if (req.headers['user-agent'].match(/MELI-JAVA-SDK-.*/))
+ res.send(200);
+ else
+ res.send(400);
+});
+
app.listen(3000);
fs.writeFileSync('/tmp/mockapi.pid', process.pid);
@@ -73,6 +73,16 @@ public void testErrorHandling() throws IOException, MeliException {
assertEquals(403, response.getStatusCode());
}
+ @Test
+ public void testUserAgent() throws IOException, MeliException {
+ Meli m = new Meli(123456, "client secret", "invalid token");
+
+ FluentStringsMap params = new FluentStringsMap();
+ params.add("access_token", m.getAccessToken());
+ Response response = m.get("/echo/user_agent", params);
+ assertEquals(200, response.getStatusCode());
+ }
+
public void testPost() throws MeliException {
Meli m = new Meli(123456, "client secret", "valid token");

0 comments on commit 6bdab5f

Please sign in to comment.