Assert updated with the returned status code instead of URL
Dependencies: ublox-at-cellular-interface
Revision 18:071ae6c6e581, committed 2019-01-30
- Comitter:
- fahim.alavi@u-blox.com
- Date:
- Wed Jan 30 16:44:51 2019 +0500
- Parent:
- 17:ac64a6b90925
- Child:
- 19:ee06f3b2b078
- Commit message:
- HTTP request timeouts increased, change of https link, buffer size increase and updated the u-blox AT cellular interface hash
Changed in this revision
--- a/TESTS/unit_tests/http/main.cpp Mon Jan 28 12:45:09 2019 +0500
+++ b/TESTS/unit_tests/http/main.cpp Wed Jan 30 16:44:51 2019 +0500
@@ -54,7 +54,7 @@
#endif
// The time to wait for a HTTP command to complete
-#define HTTP_TIMEOUT 10000
+#define HTTP_TIMEOUT 20000
// The HTTP echo server, as described in the
// first answer here:
@@ -83,7 +83,7 @@
MBED_CONF_UBLOX_CELL_BAUD_RATE,
MBED_CONF_APP_DEBUG_ON);
// A few buffers for general use
-static char buf[1024];
+static char buf[2048];
static char buf1[sizeof(buf)];
// ----------------------------------------------------------------
@@ -161,7 +161,7 @@
memset(buf, 0, sizeof (buf));
TEST_ASSERT(pDriver->httpCommand(profile, UbloxATCellularInterfaceExt::HTTP_POST_DATA,
"/post",
- NULL, NULL, 0, NULL,
+ NULL, "formData=0123456789", 0, NULL,
buf, sizeof (buf)) == NULL);
tr_debug("Received: %s", buf);
TEST_ASSERT(strstr(buf, "\"http://httpbin.org/post\"") != NULL);
@@ -231,7 +231,7 @@
buf, sizeof (buf)) == NULL);
tr_debug("Received: %s", buf);
// This is what amazon.com returns if TLS is set
- TEST_ASSERT(strstr(buf, "302 MovedTemporarily") != NULL);
+ TEST_ASSERT(strstr(buf, "503 Service Temporarily Unavailable") != NULL);
// Reset the profile and check that this now fails
TEST_ASSERT(pDriver->httpResetProfile(profile));
@@ -261,16 +261,17 @@
// Allocate first profile and use it
profiles[0] = pDriver->httpAllocProfile();
TEST_ASSERT(profiles[0] >= 0);
- TEST_ASSERT(pDriver->httpSetPar(profiles[0], UbloxATCellularInterfaceExt::HTTP_SERVER_NAME, "developer.mbed.org"));
+ TEST_ASSERT(pDriver->httpSetPar(profiles[0], UbloxATCellularInterfaceExt::HTTP_SERVER_NAME, "raw.githubusercontent.com"));
+ TEST_ASSERT(pDriver->httpSetPar(profiles[0], UbloxATCellularInterfaceExt::HTTP_SECURE, "1"));
// Check HTTP get request
memset(buf, 0, sizeof (buf));
TEST_ASSERT(pDriver->httpCommand(profiles[0], UbloxATCellularInterfaceExt::HTTP_GET,
- "/media/uploads/mbed_official/hello.txt",
+ "/u-blox/mbed-os/master/features/cellular/mbed_lib.json",
NULL, NULL, 0, NULL,
buf, sizeof (buf)) == NULL);
tr_debug("Received: %s", buf);
- TEST_ASSERT(strstr(buf, "Hello world!") != NULL);
+ TEST_ASSERT(strstr(buf, "Radio access technology to use. Value in integer: GSM=0, GSM_COMPACT=1, UTRAN=2, EGPRS=3, HSDPA=4, HSUPA=5, HSDPA_HSUPA=6, E_UTRAN=7, CATM1=8 ,NB1=9") != NULL);
// Check that we stop being able to get profiles at the max number
for (int x = 1; x < sizeof (profiles) / sizeof (profiles[0]); x++) {
@@ -296,11 +297,11 @@
// Check HTTP get request on first profile once more
memset(buf, 0, sizeof (buf));
TEST_ASSERT(pDriver->httpCommand(profiles[0], UbloxATCellularInterfaceExt::HTTP_GET,
- "/media/uploads/mbed_official/hello.txt",
+ "/u-blox/mbed-os/master/features/cellular/mbed_lib.json",
NULL, NULL, 0, NULL,
buf, sizeof (buf)) == NULL);
tr_debug("Received: %s", buf);
- TEST_ASSERT(strstr(buf, "Hello world!") != NULL);
+ TEST_ASSERT(strstr(buf, "Radio access technology to use. Value in integer: GSM=0, GSM_COMPACT=1, UTRAN=2, EGPRS=3, HSDPA=4, HSUPA=5, HSDPA_HSUPA=6, E_UTRAN=7, CATM1=8 ,NB1=9") != NULL);
// Free the profiles again
for (int x = 0; x < sizeof (profiles) / sizeof (profiles[0]); x++) {
--- a/ublox-at-cellular-interface.lib Mon Jan 28 12:45:09 2019 +0500 +++ b/ublox-at-cellular-interface.lib Wed Jan 30 16:44:51 2019 +0500 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/ublox/code/ublox-at-cellular-interface/ +https://developer.mbed.org/teams/ublox/code/ublox-at-cellular-interface/#7013521e75e7