-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
19 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
from functools import partial | ||
|
||
from wp1.db import connect | ||
from wp1.db import connect as db_connect | ||
|
||
|
||
def connect(lang): | ||
db = f'{lang}wiki_p' | ||
host = f'{db}.analytics.db.svc.eqiad.wmflabs' | ||
return connect('WIKIDB', host=replica_host, db=db) | ||
wiki = f'{lang}wiki' | ||
db = f'{wiki}_p' | ||
host = f'{wiki}.analytics.db.svc.eqiad.wmflabs' | ||
return db_connect('WIKIDB', host=host, db=db) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import unittest | ||
from unittest.mock import patch | ||
|
||
import wp1.wikilang_db | ||
|
||
|
||
class WikiLangDbTest(unittest.TestCase): | ||
|
||
@patch('wp1.wikilang_db.db_connect') | ||
def test_connect(self, mock_connect): | ||
wp1.wikilang_db.connect('fr') | ||
|
||
mock_connect.assert_called_once_with( | ||
'WIKIDB', host='frwiki.analytics.db.svc.eqiad.wmflabs', db='frwiki_p') |