def test_delete_custom_object_instance(self): # test we can delete a custom object instance expectedStdout = "" expectedStderr = "" expectedCode = 0 result = server_write(self.config, "/1000/0/100=abc") self.assertEqual(expectedStdout, result.stdout) self.assertEqual(expectedStderr, result.stderr) self.assertEqual(expectedCode, result.code) expectedStdout = "" expectedStderr = "" expectedCode = 0 result = server_delete(self.config, "/1000/0") self.assertEqual(expectedStdout, result.stdout) self.assertEqual(expectedStderr, result.stderr) self.assertEqual(expectedCode, result.code)
def test_server_read_deleted_instance(self): expectedStdout = "" expectedStderr = "" expectedCode = 0 result = server_write(self.config, "/1000/0/100=abc") self.assertEqual(expectedStdout, result.stdout) self.assertEqual(expectedStderr, result.stderr) self.assertEqual(expectedCode, result.code) result = server_delete(self.config, "/1000/0") self.assertEqual(expectedStdout, result.stdout) self.assertEqual(expectedStderr, result.stderr) self.assertEqual(expectedCode, result.code) expectedStdout = "" expectedStderr = "AwaServerReadOperation_Perform failed\nFailed to read from path /1000/0/100: AwaLWM2MError_NotFound\n" expectedCode = 1 result = server_read(self.config, "/1000/0/100") self.assertEqual(expectedStderr, result.stderr) self.assertEqual(expectedStdout, result.stdout) self.assertEqual(expectedCode, result.code)
def test_read_write_delete_read(self): # test that we can no longer read the value of a resource after it has been deleted expectedStdout = "" expectedStderr = "" expectedCode = 0 result = server_write(self.config, "/1000/0/100=abc") self.assertEqual(expectedStdout, result.stdout) self.assertEqual(expectedStderr, result.stderr) self.assertEqual(expectedCode, result.code) expectedStdout = "Object1000[/1000/0]:\n Resource100[/1000/0/100]: abc\n" expectedStderr = "" expectedCode = 0 result = server_read(self.config, "/1000/0/100") self.assertEqual(expectedStdout, result.stdout) self.assertEqual(expectedStderr, result.stderr) self.assertEqual(expectedCode, result.code) expectedStdout = "" expectedStderr = "" expectedCode = 0 result = server_delete(self.config, "/1000/0") self.assertEqual(expectedStdout, result.stdout) self.assertEqual(expectedStderr, result.stderr) self.assertEqual(expectedCode, result.code) expectedStdout = "" expectedStderr = "AwaServerReadOperation_Perform failed\nFailed to read from path /1000/0/100: AwaLWM2MError_NotFound\n" expectedCode = 1 result = server_read(self.config, "/1000/0/100") self.assertEqual(expectedStderr, result.stderr) self.assertEqual(expectedStdout, result.stdout) self.assertEqual(expectedCode, result.code)