From 8262d53280f00e205139a618b894e7906a976e2f Mon Sep 17 00:00:00 2001 From: Lukas Metzger Date: Thu, 5 Apr 2018 14:53:56 +0200 Subject: [PATCH] Updated usernames in tests --- backend/test/db.sql | 5 +++-- backend/test/test.sh | 7 ++++--- backend/test/tests/session.js | 16 ++++++++++++++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/backend/test/db.sql b/backend/test/db.sql index 111c570..8c66df2 100644 --- a/backend/test/db.sql +++ b/backend/test/db.sql @@ -218,7 +218,8 @@ CREATE TABLE `users` ( INSERT INTO `users` (`id`, `name`, `backend`, `type`, `password`) VALUES (1, 'admin', 'native', 'admin', '$2y$10$9iIDHWgjY0pEsz8pZLXPx.gkMNDxTMzb7U0Um5hUGjKmUUHWQNXcW'), -(2, 'user', 'native', 'user', '$2y$10$MktCI4XcfD0FpIFSkxex6OVifnIw3Nqw6QJueWmjVte99wx6XGBoq'); +(2, 'user', 'native', 'user', '$2y$10$MktCI4XcfD0FpIFSkxex6OVifnIw3Nqw6QJueWmjVte99wx6XGBoq'), +(3, 'configuser', 'config', 'user', NULL); -- -- Indexes for dumped tables @@ -336,7 +337,7 @@ ALTER TABLE `tsigkeys` -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/backend/test/test.sh b/backend/test/test.sh index 78a2f0e..bded231 100755 --- a/backend/test/test.sh +++ b/backend/test/test.sh @@ -23,11 +23,12 @@ return [ 'prefix' => 'default', 'config' => null ], - 'foo' => [ + 'config' => [ 'plugin' => 'config', - 'prefix' => 'foo', + 'prefix' => 'config', 'config' => [ - 'admin' => '\$2y\$10\$u9ji0cGRpd/doYEF/AztkOP3qmaaDYOGXzs0PmnGbMF7sJYzODDbO' + 'configuser' => '\$2y\$10\$twlIJ0hYeaHqMsiM7OdLr.4HkV6/EEQneDg9uZiU.l7yn1bpxSD1.', + 'notindb' => '\$2y\$10\$z1dD1Q5u68l5iqEmqnOAVuoR5VWR77HUfxMUycJ9TdDG3H5dLZGVW' ] ] ] diff --git a/backend/test/tests/session.js b/backend/test/tests/session.js index 741e7d1..f2789b2 100644 --- a/backend/test/tests/session.js +++ b/backend/test/tests/session.js @@ -54,8 +54,20 @@ test.run(async function () { url: '/sessions', method: 'post', data: { - username: 'foo/admin', - password: 'admin' + username: 'config/configuser', + password: 'configuser' + } + }); + + assert.equal(res.status, 201, 'Status not valid'); + + //Try to login with prefix but no db entry + var res = await req({ + url: '/sessions', + method: 'post', + data: { + username: 'config/notindb', + password: 'notindb' } });