BPD tests: password command

This commit is contained in:
Carl Suster 2019-03-26 22:00:54 +11:00
parent 078c583434
commit 59e66aaa7f

View file

@ -164,6 +164,26 @@ class BPDTest(unittest.TestCase, TestHelper):
response = self.client.send_command(b'ping')
self.assertTrue(response.ok)
def test_cmd_password(self):
self.server_proc.terminate()
self.server_proc, self.client = self.make_server_client(
password='abc123')
response = self.client.send_command(b'status')
self.assertTrue(response.err)
self.assertEqual(response.status,
b'ACK [4@0] {} insufficient privileges')
response = self.client.send_command(b'password', b'wrong')
self.assertTrue(response.err)
self.assertEqual(response.status,
b'ACK [3@0] {password} incorrect password')
response = self.client.send_command(b'password', b'abc123')
self.assertTrue(response.ok)
response = self.client.send_command(b'status')
self.assertTrue(response.ok)
def suite():
return unittest.TestLoader().loadTestsFromName(__name__)