Sfoglia il codice sorgente

Updated usernames in tests

Lukas Metzger 7 anni fa
parent
commit
8262d53280
3 ha cambiato i file con 21 aggiunte e 7 eliminazioni
  1. 3 2
      backend/test/db.sql
  2. 4 3
      backend/test/test.sh
  3. 14 2
      backend/test/tests/session.js

+ 3 - 2
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 */;

+ 4 - 3
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'
             ]
         ]
     ]

+ 14 - 2
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'
             }
         });