diff options
-rw-r--r-- | main.py | 4 | ||||
-rw-r--r-- | tests/test_main.py | 4 |
2 files changed, 4 insertions, 4 deletions
@@ -71,9 +71,9 @@ def fetch_markets(user): | |||
71 | cursor = dbs.psql.cursor() | 71 | cursor = dbs.psql.cursor() |
72 | 72 | ||
73 | if user is None: | 73 | if user is None: |
74 | cursor.execute("SELECT id,config,user_id FROM market_configs") | 74 | cursor.execute("SELECT id,config,user_id FROM market_configs WHERE status='enabled'") |
75 | else: | 75 | else: |
76 | cursor.execute("SELECT id,config,user_id FROM market_configs WHERE user_id = %s", user) | 76 | cursor.execute("SELECT id,config,user_id FROM market_configs WHERE status='enabled' AND user_id = %s", user) |
77 | 77 | ||
78 | for row in cursor: | 78 | for row in cursor: |
79 | yield row | 79 | yield row |
diff --git a/tests/test_main.py b/tests/test_main.py index 1864c06..298e29e 100644 --- a/tests/test_main.py +++ b/tests/test_main.py | |||
@@ -325,7 +325,7 @@ class MainTest(WebMockTestCase): | |||
325 | with self.subTest(user=None): | 325 | with self.subTest(user=None): |
326 | rows = list(main.fetch_markets(None)) | 326 | rows = list(main.fetch_markets(None)) |
327 | 327 | ||
328 | cursor_mock.execute.assert_called_once_with("SELECT id,config,user_id FROM market_configs") | 328 | cursor_mock.execute.assert_called_once_with("SELECT id,config,user_id FROM market_configs WHERE status='enabled'") |
329 | 329 | ||
330 | self.assertEqual(["row_1", "row_2"], rows) | 330 | self.assertEqual(["row_1", "row_2"], rows) |
331 | 331 | ||
@@ -333,7 +333,7 @@ class MainTest(WebMockTestCase): | |||
333 | with self.subTest(user=1): | 333 | with self.subTest(user=1): |
334 | rows = list(main.fetch_markets(1)) | 334 | rows = list(main.fetch_markets(1)) |
335 | 335 | ||
336 | cursor_mock.execute.assert_called_once_with("SELECT id,config,user_id FROM market_configs WHERE user_id = %s", 1) | 336 | cursor_mock.execute.assert_called_once_with("SELECT id,config,user_id FROM market_configs WHERE status='enabled' AND user_id = %s", 1) |
337 | 337 | ||
338 | self.assertEqual(["row_1", "row_2"], rows) | 338 | self.assertEqual(["row_1", "row_2"], rows) |
339 | 339 | ||