forkeado de spla/fediverse
use database creation database
This commit is contained in:
pare
a806bbe859
commit
298d8cb9c2
S'han modificat 5 arxius amb 25 adicions i 6 eliminacions
0
config/test_db_config.txt
Normal file
0
config/test_db_config.txt
Normal file
|
@ -16,10 +16,10 @@ class Database():
|
|||
|
||||
def __init__(self, config_file=None, fediverse_db=None, fediverse_db_user=None, fediverse_db_user_password=None):
|
||||
|
||||
self.config_file = "config/db_config.txt"
|
||||
self.fediverse_db = self.__get_parameter("fediverse_db", self.config_file)
|
||||
self.fediverse_db_user = self.__get_parameter("fediverse_db_user", self.config_file)
|
||||
self.fediverse_db_user_password = self.__get_parameter("fediverse_db_user_password", self.config_file)
|
||||
self.config_file = config_file or "config/db_config.txt"
|
||||
self.fediverse_db = fediverse_db or self.__get_parameter("fediverse_db", self.config_file)
|
||||
self.fediverse_db_user = fediverse_db_user or self.__get_parameter("fediverse_db_user", self.config_file)
|
||||
self.fediverse_db_user_password = fediverse_db_user_password or self.__get_parameter("fediverse_db_user_password", self.config_file)
|
||||
|
||||
db_setup = self.__check_dbsetup(self)
|
||||
|
||||
|
@ -29,7 +29,7 @@ class Database():
|
|||
self.fediverse_db_user = input("\nFediverse database user: ")
|
||||
self.fediverse_db_user_password = input("\nFediverse database user password: ")
|
||||
|
||||
self.__createdb(self)
|
||||
self.__createdb(self)
|
||||
self.__create_config(self)
|
||||
self.__write_config(self)
|
||||
|
||||
|
@ -844,7 +844,7 @@ class Database():
|
|||
conn.close()
|
||||
|
||||
def get_uptime(self):
|
||||
|
||||
|
||||
try:
|
||||
|
||||
conn = None
|
||||
|
|
10
requirements-dev.txt
Normal file
10
requirements-dev.txt
Normal file
|
@ -0,0 +1,10 @@
|
|||
requests
|
||||
psycopg2-binary
|
||||
pytz
|
||||
ray
|
||||
Mastodon.py
|
||||
matplotlib
|
||||
pandas
|
||||
humanfriendly
|
||||
pytest
|
||||
ipdb
|
1
tests/__init__.py
Normal file
1
tests/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
#!/usr/bin/env python3
|
|
@ -0,0 +1,8 @@
|
|||
from federation import Database
|
||||
|
||||
def test__database_connection():
|
||||
db = Database(config_file='config/test_db_config.txt')
|
||||
|
||||
checked_server = db.get_last_checked_servers()
|
||||
|
||||
assert checked_server
|
Loading…
Referencia en una nova incidència