From 4b6279dffdf81dd163dfe4d76daf804fd2e9fbc7 Mon Sep 17 00:00:00 2001 From: Sangwan Kwon Date: Mon, 24 Feb 2020 18:14:53 +0900 Subject: [PATCH] policy: Enhance testcase on bluetooth vtab Signed-off-by: Sangwan Kwon --- plugins/bluetooth/bluetooth-test.cpp | 18 +++++++++++++++++- src/vist/client/schema/bluetooth.hpp | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/plugins/bluetooth/bluetooth-test.cpp b/plugins/bluetooth/bluetooth-test.cpp index c61ce4e..6a68d7b 100644 --- a/plugins/bluetooth/bluetooth-test.cpp +++ b/plugins/bluetooth/bluetooth-test.cpp @@ -18,6 +18,7 @@ #include "../test-util.hpp" #include +#include #include #include @@ -25,10 +26,11 @@ #include using namespace vist; -using namespace vist::policy::plugin; TEST(BluetoothTests, change_policy_state) { + using namespace vist::policy::plugin; + try { test::change_policy_state(); test::change_policy_state(); @@ -65,3 +67,17 @@ TEST(BluetoothTests, set_policies) Query::Execute("DELETE FROM policy_admin WHERE name = 'vist-plugin-bluetooth-test'"); } + +TEST(BluetoothTest, query_builder) +{ + using namespace vist::schema; + + std::string query = BluetoothTable.selectAll(); + EXPECT_EQ(query, "SELECT * FROM bluetooth"); + + query = BluetoothTable.update(Bluetooth::DesktopConnectivity = 3, Bluetooth::State = 7); + EXPECT_EQ(query, "UPDATE bluetooth SET desktopConnectivity = 3, state = 7"); + + query = BluetoothTable.update(Bluetooth::Pairing = 2, Bluetooth::Tethering = 9); + EXPECT_EQ(query, "UPDATE bluetooth SET pairing = 2, tethering = 9"); +} diff --git a/src/vist/client/schema/bluetooth.hpp b/src/vist/client/schema/bluetooth.hpp index c44c393..dd8f3ad 100644 --- a/src/vist/client/schema/bluetooth.hpp +++ b/src/vist/client/schema/bluetooth.hpp @@ -33,7 +33,7 @@ namespace schema { DECLARE_COLUMN(Tethering, "tethering", &Bluetooth::tethering); }; - DECLARE_TABLE(bluetoothTable, "bluetooth", Bluetooth::State, + DECLARE_TABLE(BluetoothTable, "bluetooth", Bluetooth::State, Bluetooth::DesktopConnectivity, Bluetooth::Pairing, Bluetooth::Tethering); -- 2.34.1