rename everything (#50)
* fixed visualization * simplified tests * split into files * refactored test expected publications * split update tests * expanded specifications and tests * added event_status window tests * fixed 'all' command * renamed everything * fixed uppercase
This commit is contained in:
parent
450e5b0044
commit
2c8063cf4a
|
@ -1,4 +1,4 @@
|
|||
The goal of mobilizon_bots is to provide a suite to reshare Mobilizon events on a broad selection of platforms. This
|
||||
The goal of mobilizon_reshare is to provide a suite to reshare Mobilizon events on a broad selection of platforms. This
|
||||
tool enables an organization to automate their social media strategy in regards
|
||||
to events and their promotion.
|
||||
|
||||
|
@ -9,7 +9,7 @@ to events and their promotion.
|
|||
## Scheduling and temporal logic
|
||||
|
||||
The tool is designed to work in combination with a scheduler that executes it at
|
||||
regular intervals. Mobilizon_bots allows fine-grained control over the logic to decide when
|
||||
regular intervals. mobilizon_reshare allows fine-grained control over the logic to decide when
|
||||
to publish an event, with the minimization of human effort as its first priority.
|
||||
|
||||
## Configuration
|
||||
|
@ -17,7 +17,7 @@ to publish an event, with the minimization of human effort as its first priority
|
|||
The configuration is implemented through Dynaconf. It allows a variety of ways to specify configuration keys.
|
||||
Refer to their [documentation](https://www.dynaconf.com/) to discover how configuration files and environment variables can be specified.
|
||||
|
||||
We provide a sample configuration in the [settings.toml](https://github.com/Tech-Workers-Coalition-Italia/mobilizon-bots/blob/master/mobilizon_bots/settings.toml) file.
|
||||
We provide a sample configuration in the [settings.toml](https://github.com/Tech-Workers-Coalition-Italia/mobilizon-reshare/blob/master/mobilizon_reshare/settings.toml) file.
|
||||
|
||||
### Event selection
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
from mobilizon_bots.config.config import get_settings
|
||||
import mobilizon_bots.config.publishers
|
||||
|
||||
|
||||
def get_active_publishers():
|
||||
return mobilizon_bots.config.publishers.get_active_publishers(get_settings())
|
|
@ -4,8 +4,8 @@ import traceback
|
|||
from logging.config import dictConfig
|
||||
from pathlib import Path
|
||||
|
||||
from mobilizon_bots.config.config import update_settings_files
|
||||
from mobilizon_bots.storage.db import tear_down, MobilizonBotsDB
|
||||
from mobilizon_reshare.config.config import update_settings_files
|
||||
from mobilizon_reshare.storage.db import tear_down, MoReDB
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -19,7 +19,7 @@ async def init(settings_file):
|
|||
settings = update_settings_files(settings_file)
|
||||
dictConfig(settings["logging"])
|
||||
db_path = Path(settings.db_path)
|
||||
db = MobilizonBotsDB(db_path)
|
||||
db = MoReDB(db_path)
|
||||
await db.setup()
|
||||
|
||||
|
|
@ -4,10 +4,10 @@ import click
|
|||
from arrow import Arrow
|
||||
from click import pass_context, pass_obj
|
||||
|
||||
from mobilizon_bots.cli import safe_execution
|
||||
from mobilizon_bots.cli.inspect_event import inspect_events
|
||||
from mobilizon_bots.cli.main import main
|
||||
from mobilizon_bots.event.event import EventPublicationStatus
|
||||
from mobilizon_reshare.cli import safe_execution
|
||||
from mobilizon_reshare.cli.inspect_event import inspect_events
|
||||
from mobilizon_reshare.cli.main import main
|
||||
from mobilizon_reshare.event.event import EventPublicationStatus
|
||||
|
||||
settings_file_option = click.option("--settings-file", type=click.Path(exists=True))
|
||||
from_date_option = click.option(
|
||||
|
@ -25,17 +25,17 @@ to_date_option = click.option(
|
|||
|
||||
|
||||
@click.group()
|
||||
def mobilizon_bots():
|
||||
def mobilizon_reshare():
|
||||
pass
|
||||
|
||||
|
||||
@mobilizon_bots.command()
|
||||
@mobilizon_reshare.command()
|
||||
@settings_file_option
|
||||
def start(settings_file):
|
||||
safe_execution(main, settings_file=settings_file)
|
||||
|
||||
|
||||
@mobilizon_bots.group()
|
||||
@mobilizon_reshare.group()
|
||||
@from_date_option
|
||||
@to_date_option
|
||||
@pass_context
|
||||
|
@ -117,4 +117,4 @@ def completed(obj, settings_file):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
mobilizon_bots()
|
||||
mobilizon_reshare()
|
|
@ -3,10 +3,10 @@ from typing import Iterable
|
|||
import click
|
||||
from arrow import Arrow
|
||||
|
||||
from mobilizon_bots.event.event import EventPublicationStatus
|
||||
from mobilizon_bots.event.event import MobilizonEvent
|
||||
from mobilizon_bots.storage.query import get_all_events
|
||||
from mobilizon_bots.storage.query import events_with_status
|
||||
from mobilizon_reshare.event.event import EventPublicationStatus
|
||||
from mobilizon_reshare.event.event import MobilizonEvent
|
||||
from mobilizon_reshare.storage.query import get_all_events
|
||||
from mobilizon_reshare.storage.query import events_with_status
|
||||
|
||||
|
||||
status_to_color = {
|
|
@ -1,12 +1,12 @@
|
|||
import logging.config
|
||||
|
||||
|
||||
from mobilizon_bots.event.event_selection_strategies import select_event_to_publish
|
||||
from mobilizon_bots.mobilizon.events import get_unpublished_events
|
||||
from mobilizon_bots.models.publication import PublicationStatus
|
||||
from mobilizon_bots.publishers import get_active_publishers
|
||||
from mobilizon_bots.publishers.coordinator import PublisherCoordinator
|
||||
from mobilizon_bots.storage.query import (
|
||||
from mobilizon_reshare.event.event_selection_strategies import select_event_to_publish
|
||||
from mobilizon_reshare.mobilizon.events import get_unpublished_events
|
||||
from mobilizon_reshare.models.publication import PublicationStatus
|
||||
from mobilizon_reshare.publishers import get_active_publishers
|
||||
from mobilizon_reshare.publishers.coordinator import PublisherCoordinator
|
||||
from mobilizon_reshare.storage.query import (
|
||||
get_published_events,
|
||||
get_unpublished_events as get_db_unpublished_events,
|
||||
create_unpublished_events,
|
|
@ -3,9 +3,10 @@ from typing import List
|
|||
|
||||
from dynaconf import Dynaconf, Validator
|
||||
|
||||
from mobilizon_bots.config import strategies, publishers, notifiers
|
||||
from mobilizon_bots.config.notifiers import notifier_names
|
||||
from mobilizon_bots.config.publishers import publisher_names
|
||||
from mobilizon_reshare.config import strategies, publishers, notifiers
|
||||
from mobilizon_reshare.config.notifiers import notifier_names
|
||||
|
||||
from mobilizon_reshare.config.publishers import publisher_names
|
||||
|
||||
|
||||
def build_settings(
|
||||
|
@ -13,15 +14,15 @@ def build_settings(
|
|||
):
|
||||
SETTINGS_FILE = (
|
||||
settings_files
|
||||
or os.environ.get("MOBILIZON_BOTS_SETTINGS_FILE")
|
||||
or os.environ.get("MOBILIZION_RESHARE_SETTINGS_FILE")
|
||||
or [
|
||||
"mobilizon_bots/settings.toml",
|
||||
"mobilizon_bots/.secrets.toml",
|
||||
"/etc/mobilizon_bots.toml",
|
||||
"/etc/mobilizon_bots_secrets.toml",
|
||||
"mobilizon_reshare/settings.toml",
|
||||
"mobilizon_reshare/.secrets.toml",
|
||||
"/etc/mobilizon_reshare.toml",
|
||||
"/etc/mobilizon_reshare_secrets.toml",
|
||||
]
|
||||
)
|
||||
ENVVAR_PREFIX = "MOBILIZON_BOTS"
|
||||
ENVVAR_PREFIX = "MOBILIZON_RESHARE"
|
||||
|
||||
return Dynaconf(
|
||||
environments=True,
|
|
@ -6,8 +6,8 @@ import arrow
|
|||
import tortoise.timezone
|
||||
from jinja2 import Template
|
||||
|
||||
from mobilizon_bots.models.event import Event
|
||||
from mobilizon_bots.models.publication import PublicationStatus, Publication
|
||||
from mobilizon_reshare.models.event import Event
|
||||
from mobilizon_reshare.models.publication import PublicationStatus, Publication
|
||||
|
||||
|
||||
class EventPublicationStatus(IntEnum):
|
|
@ -4,8 +4,8 @@ from typing import List, Optional
|
|||
|
||||
import arrow
|
||||
|
||||
from mobilizon_bots.config.config import get_settings
|
||||
from mobilizon_bots.event.event import MobilizonEvent
|
||||
from mobilizon_reshare.config.config import get_settings
|
||||
from mobilizon_reshare.event.event import MobilizonEvent
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -93,8 +93,7 @@ STRATEGY_NAME_TO_STRATEGY_CLASS = {"next_event": SelectNextEventStrategy}
|
|||
|
||||
|
||||
def select_event_to_publish(
|
||||
published_events: List[MobilizonEvent],
|
||||
unpublished_events: List[MobilizonEvent],
|
||||
published_events: List[MobilizonEvent], unpublished_events: List[MobilizonEvent],
|
||||
):
|
||||
|
||||
strategy = STRATEGY_NAME_TO_STRATEGY_CLASS[
|
|
@ -6,8 +6,8 @@ from typing import List, Optional
|
|||
import arrow
|
||||
import requests
|
||||
|
||||
from mobilizon_bots.config.config import get_settings
|
||||
from mobilizon_bots.event.event import MobilizonEvent, EventPublicationStatus
|
||||
from mobilizon_reshare.config.config import get_settings
|
||||
from mobilizon_reshare.event.event import MobilizonEvent, EventPublicationStatus
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
from mobilizon_reshare.config.config import get_settings
|
||||
import mobilizon_reshare.config.publishers
|
||||
|
||||
|
||||
def get_active_publishers():
|
||||
return mobilizon_reshare.config.publishers.get_active_publishers(get_settings())
|
|
@ -5,8 +5,8 @@ from abc import ABC, abstractmethod
|
|||
from dynaconf.utils.boxing import DynaBox
|
||||
from jinja2 import Environment, FileSystemLoader, Template
|
||||
|
||||
from mobilizon_bots.config.config import get_settings
|
||||
from mobilizon_bots.event.event import MobilizonEvent
|
||||
from mobilizon_reshare.config.config import get_settings
|
||||
from mobilizon_reshare.event.event import MobilizonEvent
|
||||
from .exceptions import PublisherError, InvalidAttribute
|
||||
|
||||
JINJA_ENV = Environment(loader=FileSystemLoader("/"))
|
|
@ -1,10 +1,10 @@
|
|||
from dataclasses import dataclass, field
|
||||
from uuid import UUID
|
||||
|
||||
from mobilizon_bots.event.event import MobilizonEvent
|
||||
from mobilizon_bots.models.publication import PublicationStatus
|
||||
from mobilizon_bots.publishers.exceptions import PublisherError
|
||||
from mobilizon_bots.publishers.telegram import TelegramPublisher
|
||||
from mobilizon_reshare.event.event import MobilizonEvent
|
||||
from mobilizon_reshare.models.publication import PublicationStatus
|
||||
from mobilizon_reshare.publishers.exceptions import PublisherError
|
||||
from mobilizon_reshare.publishers.telegram import TelegramPublisher
|
||||
|
||||
KEY2CLS = {"telegram": TelegramPublisher}
|
||||
|
||||
|
@ -32,7 +32,8 @@ class PublisherCoordinatorReport:
|
|||
class PublisherCoordinator:
|
||||
def __init__(self, event: MobilizonEvent, publications: list[tuple[UUID, str]]):
|
||||
self.publications = tuple(
|
||||
(publication_id, KEY2CLS[publisher_name](event)) for publication_id, publisher_name in publications
|
||||
(publication_id, KEY2CLS[publisher_name](event))
|
||||
for publication_id, publisher_name in publications
|
||||
)
|
||||
|
||||
def run(self) -> PublisherCoordinatorReport:
|
||||
|
@ -45,8 +46,7 @@ class PublisherCoordinator:
|
|||
def _make_successful_report(self):
|
||||
return {
|
||||
publication_id: PublicationReport(
|
||||
status=PublicationStatus.COMPLETED,
|
||||
reason="",
|
||||
status=PublicationStatus.COMPLETED, reason="",
|
||||
)
|
||||
for publication_id, _ in self.publications
|
||||
}
|
||||
|
@ -58,8 +58,7 @@ class PublisherCoordinator:
|
|||
p.post()
|
||||
except PublisherError as e:
|
||||
failed_publishers_reports[publication_id] = PublicationReport(
|
||||
status=PublicationStatus.FAILED,
|
||||
reason=repr(e),
|
||||
status=PublicationStatus.FAILED, reason=repr(e),
|
||||
)
|
||||
reports = failed_publishers_reports or self._make_successful_report()
|
||||
return PublisherCoordinatorReport(reports)
|
|
@ -18,7 +18,7 @@ class TelegramPublisher(AbstractPublisher):
|
|||
|
||||
_conf = ("publisher", "telegram")
|
||||
default_template_path = pkg_resources.resource_filename(
|
||||
"mobilizon_bots.publishers.templates", "telegram.tmpl.j2"
|
||||
"mobilizon_reshare.publishers.templates", "telegram.tmpl.j2"
|
||||
)
|
||||
|
||||
def post(self) -> None:
|
|
@ -1,8 +1,8 @@
|
|||
[default]
|
||||
debug = true
|
||||
default = true
|
||||
local_state_dir = "/var/mobilizon_bots"
|
||||
log_dir = "/var/log/mobilizon_bots"
|
||||
local_state_dir = "/var/mobilizon_reshare"
|
||||
log_dir = "/var/log/mobilizon_reshare"
|
||||
db_name = "events.db"
|
||||
db_path = "@format {this.local_state_dir}/{this.db_name}"
|
||||
|
||||
|
@ -66,7 +66,7 @@ stream = "ext://sys.stderr"
|
|||
level = "DEBUG"
|
||||
class = "logging.handlers.RotatingFileHandler"
|
||||
formatter = "standard"
|
||||
filename = "@format {this.log_dir}/mobilizon_bots.log"
|
||||
filename = "@format {this.log_dir}/mobilizon_reshare.log"
|
||||
maxBytes = 52428800
|
||||
backupCount = 500
|
||||
encoding = "utf8"
|
|
@ -5,13 +5,13 @@ from pathlib import Path
|
|||
|
||||
from tortoise import Tortoise
|
||||
|
||||
from mobilizon_bots.config.publishers import publisher_names
|
||||
from mobilizon_bots.storage.query import update_publishers
|
||||
from mobilizon_reshare.config.publishers import publisher_names
|
||||
from mobilizon_reshare.storage.query import update_publishers
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class MobilizonBotsDB:
|
||||
class MoReDB:
|
||||
def __init__(self, path: Path):
|
||||
self.path = path
|
||||
# TODO: Check if DB is openable/"queriable"
|
||||
|
@ -24,10 +24,10 @@ class MobilizonBotsDB:
|
|||
db_url=f"sqlite:///{self.path}",
|
||||
modules={
|
||||
"models": [
|
||||
"mobilizon_bots.models.event",
|
||||
"mobilizon_bots.models.notification",
|
||||
"mobilizon_bots.models.publication",
|
||||
"mobilizon_bots.models.publisher",
|
||||
"mobilizon_reshare.models.event",
|
||||
"mobilizon_reshare.models.notification",
|
||||
"mobilizon_reshare.models.publication",
|
||||
"mobilizon_reshare.models.publisher",
|
||||
]
|
||||
},
|
||||
# always store UTC time in database
|
|
@ -8,11 +8,11 @@ from arrow import Arrow
|
|||
from tortoise.queryset import QuerySet
|
||||
from tortoise.transactions import atomic
|
||||
|
||||
from mobilizon_bots.event.event import MobilizonEvent, EventPublicationStatus
|
||||
from mobilizon_bots.models.event import Event
|
||||
from mobilizon_bots.models.publication import Publication, PublicationStatus
|
||||
from mobilizon_bots.models.publisher import Publisher
|
||||
from mobilizon_bots.publishers.coordinator import PublisherCoordinatorReport
|
||||
from mobilizon_reshare.event.event import MobilizonEvent, EventPublicationStatus
|
||||
from mobilizon_reshare.models.event import Event
|
||||
from mobilizon_reshare.models.publication import Publication, PublicationStatus
|
||||
from mobilizon_reshare.models.publisher import Publisher
|
||||
from mobilizon_reshare.publishers.coordinator import PublisherCoordinatorReport
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -90,8 +90,7 @@ async def events_with_status(
|
|||
|
||||
|
||||
async def get_all_events(
|
||||
from_date: Optional[Arrow] = None,
|
||||
to_date: Optional[Arrow] = None,
|
||||
from_date: Optional[Arrow] = None, to_date: Optional[Arrow] = None,
|
||||
) -> Iterable[MobilizonEvent]:
|
||||
|
||||
return map(
|
||||
|
@ -140,9 +139,7 @@ async def create_publisher(name: str, account_ref: Optional[str] = None) -> None
|
|||
|
||||
|
||||
@atomic(CONNECTION_NAME)
|
||||
async def update_publishers(
|
||||
names: Iterable[str],
|
||||
) -> None:
|
||||
async def update_publishers(names: Iterable[str],) -> None:
|
||||
names = set(names)
|
||||
known_publisher_names = set(p.name for p in await get_publishers())
|
||||
for name in names.difference(known_publisher_names):
|
||||
|
@ -157,9 +154,7 @@ async def save_publication(
|
|||
|
||||
publisher = await get_publishers(publisher_name)
|
||||
await Publication.create(
|
||||
status=status,
|
||||
event_id=event_model.id,
|
||||
publisher_id=publisher.id,
|
||||
status=status, event_id=event_model.id, publisher_id=publisher.id,
|
||||
)
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
[tool.poetry]
|
||||
name = "mobilizon-bots"
|
||||
name = "mobilizon-reshare"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["Simone Robutti <simone.robutti@protonmail.com>"]
|
||||
|
@ -27,4 +27,4 @@ requires = ["poetry-core>=1.0.0"]
|
|||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
mobilizon-bots="mobilizon_bots.cli.cli:mobilizon_bots"
|
||||
mobilizon-reshare="mobilizon_reshare.cli.cli:mobilizon_reshare"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from mobilizon_bots.config.config import get_settings, update_settings_files
|
||||
from mobilizon_reshare.config.config import get_settings, update_settings_files
|
||||
|
||||
|
||||
def test_singleton():
|
||||
|
|
|
@ -2,7 +2,7 @@ import dynaconf
|
|||
import pkg_resources
|
||||
import pytest
|
||||
|
||||
from mobilizon_bots.config.config import update_settings_files
|
||||
from mobilizon_reshare.config.config import update_settings_files
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -5,11 +5,11 @@ import arrow
|
|||
import pytest
|
||||
from tortoise.contrib.test import finalizer, initializer
|
||||
|
||||
from mobilizon_bots.event.event import MobilizonEvent, EventPublicationStatus
|
||||
from mobilizon_bots.models.event import Event
|
||||
from mobilizon_bots.models.notification import Notification, NotificationStatus
|
||||
from mobilizon_bots.models.publication import Publication, PublicationStatus
|
||||
from mobilizon_bots.models.publisher import Publisher
|
||||
from mobilizon_reshare.event.event import MobilizonEvent, EventPublicationStatus
|
||||
from mobilizon_reshare.models.event import Event
|
||||
from mobilizon_reshare.models.notification import Notification, NotificationStatus
|
||||
from mobilizon_reshare.models.publication import Publication, PublicationStatus
|
||||
from mobilizon_reshare.models.publisher import Publisher
|
||||
|
||||
|
||||
def generate_publication_status(published):
|
||||
|
@ -83,10 +83,10 @@ def initialize_db_tests(request) -> None:
|
|||
db_url = os.environ.get("TORTOISE_TEST_DB", "sqlite://:memory:")
|
||||
initializer(
|
||||
[
|
||||
"mobilizon_bots.models.event",
|
||||
"mobilizon_bots.models.notification",
|
||||
"mobilizon_bots.models.publication",
|
||||
"mobilizon_bots.models.publisher",
|
||||
"mobilizon_reshare.models.event",
|
||||
"mobilizon_reshare.models.notification",
|
||||
"mobilizon_reshare.models.publication",
|
||||
"mobilizon_reshare.models.publisher",
|
||||
],
|
||||
db_url=db_url,
|
||||
app_label="models",
|
||||
|
@ -123,9 +123,7 @@ def event_model_generator():
|
|||
|
||||
@pytest.fixture()
|
||||
def publisher_model_generator():
|
||||
def _publisher_model_generator(
|
||||
idx=1,
|
||||
):
|
||||
def _publisher_model_generator(idx=1,):
|
||||
return Publisher(name=f"publisher_{idx}", account_ref=f"account_ref_{idx}")
|
||||
|
||||
return _publisher_model_generator
|
||||
|
|
|
@ -3,8 +3,8 @@ import pytest
|
|||
from unittest.mock import patch
|
||||
|
||||
|
||||
from mobilizon_bots.config.config import get_settings
|
||||
from mobilizon_bots.event.event_selection_strategies import (
|
||||
from mobilizon_reshare.config.config import get_settings
|
||||
from mobilizon_reshare.event.event_selection_strategies import (
|
||||
SelectNextEventStrategy,
|
||||
select_event_to_publish,
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import pytest
|
||||
|
||||
from mobilizon_bots.formatting.description import html_to_markdown
|
||||
from mobilizon_reshare.formatting.description import html_to_markdown
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import pytest
|
||||
|
||||
from mobilizon_bots.formatting.description import html_to_plaintext
|
||||
from mobilizon_reshare.formatting.description import html_to_plaintext
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import pytest
|
||||
import responses
|
||||
|
||||
from mobilizon_bots.config.config import get_settings
|
||||
from mobilizon_reshare.config.config import get_settings
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -15,10 +15,7 @@ def mock_mobilizon_success_answer(mobilizon_answer, mobilizon_url):
|
|||
with responses.RequestsMock() as rsps:
|
||||
|
||||
rsps.add(
|
||||
responses.POST,
|
||||
mobilizon_url,
|
||||
json=mobilizon_answer,
|
||||
status=200,
|
||||
responses.POST, mobilizon_url, json=mobilizon_answer, status=200,
|
||||
)
|
||||
yield
|
||||
|
||||
|
@ -29,8 +26,6 @@ def mock_mobilizon_failure_answer(mobilizon_url):
|
|||
with responses.RequestsMock() as rsps:
|
||||
|
||||
rsps.add(
|
||||
responses.POST,
|
||||
mobilizon_url,
|
||||
status=500,
|
||||
responses.POST, mobilizon_url, status=500,
|
||||
)
|
||||
yield
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import arrow
|
||||
import pytest
|
||||
|
||||
from mobilizon_bots.event.event import MobilizonEvent
|
||||
from mobilizon_bots.mobilizon.events import (
|
||||
from mobilizon_reshare.event.event import MobilizonEvent
|
||||
from mobilizon_reshare.mobilizon.events import (
|
||||
get_mobilizon_future_events,
|
||||
MobilizonRequestFailed,
|
||||
get_unpublished_events,
|
||||
|
|
|
@ -4,10 +4,10 @@ import arrow
|
|||
import pytest
|
||||
import tortoise.timezone
|
||||
|
||||
from mobilizon_bots.event.event import MobilizonEvent
|
||||
from mobilizon_bots.models.event import Event
|
||||
from mobilizon_bots.models.publication import PublicationStatus
|
||||
from mobilizon_bots.event.event import EventPublicationStatus
|
||||
from mobilizon_reshare.event.event import MobilizonEvent
|
||||
from mobilizon_reshare.models.event import Event
|
||||
from mobilizon_reshare.models.publication import PublicationStatus
|
||||
from mobilizon_reshare.event.event import EventPublicationStatus
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import pytest
|
||||
|
||||
from mobilizon_bots.models.notification import Notification, NotificationStatus
|
||||
from mobilizon_reshare.models.notification import Notification, NotificationStatus
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
@ -3,7 +3,7 @@ import pytest
|
|||
from datetime import datetime
|
||||
from tortoise import timezone
|
||||
|
||||
from mobilizon_bots.models.publication import Publication, PublicationStatus
|
||||
from mobilizon_reshare.models.publication import Publication, PublicationStatus
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import pytest
|
||||
|
||||
from mobilizon_bots.models.publisher import Publisher
|
||||
from mobilizon_reshare.models.publisher import Publisher
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
@ -2,9 +2,9 @@ import pytest
|
|||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from mobilizon_bots.event.event import MobilizonEvent
|
||||
from mobilizon_bots.publishers.abstract import AbstractPublisher
|
||||
from mobilizon_bots.publishers.exceptions import PublisherError
|
||||
from mobilizon_reshare.event.event import MobilizonEvent
|
||||
from mobilizon_reshare.publishers.abstract import AbstractPublisher
|
||||
from mobilizon_reshare.publishers.exceptions import PublisherError
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -2,8 +2,8 @@ from datetime import datetime, timezone, timedelta
|
|||
|
||||
from uuid import UUID
|
||||
|
||||
from mobilizon_bots.models.publication import PublicationStatus
|
||||
from mobilizon_bots.models.publication import Publication
|
||||
from mobilizon_reshare.models.publication import PublicationStatus
|
||||
from mobilizon_reshare.models.publication import Publication
|
||||
|
||||
today = datetime(
|
||||
year=2021, month=6, day=6, hour=5, minute=0, tzinfo=timezone(timedelta(hours=2)),
|
||||
|
|
|
@ -4,9 +4,9 @@ from uuid import UUID
|
|||
|
||||
import pytest
|
||||
|
||||
from mobilizon_bots.models.event import Event
|
||||
from mobilizon_bots.models.publication import PublicationStatus, Publication
|
||||
from mobilizon_bots.models.publisher import Publisher
|
||||
from mobilizon_reshare.models.event import Event
|
||||
from mobilizon_reshare.models.publication import PublicationStatus, Publication
|
||||
from mobilizon_reshare.models.publisher import Publisher
|
||||
from tests.storage import today
|
||||
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ from datetime import timedelta
|
|||
import arrow
|
||||
import pytest
|
||||
|
||||
from mobilizon_bots.event.event import MobilizonEvent, EventPublicationStatus
|
||||
from mobilizon_bots.models.event import Event
|
||||
from mobilizon_bots.models.publication import PublicationStatus
|
||||
from mobilizon_bots.storage.query import events_with_status
|
||||
from mobilizon_bots.storage.query import (
|
||||
from mobilizon_reshare.event.event import MobilizonEvent, EventPublicationStatus
|
||||
from mobilizon_reshare.models.event import Event
|
||||
from mobilizon_reshare.models.publication import PublicationStatus
|
||||
from mobilizon_reshare.storage.query import events_with_status
|
||||
from mobilizon_reshare.storage.query import (
|
||||
get_published_events,
|
||||
get_unpublished_events,
|
||||
create_unpublished_events,
|
||||
|
|
|
@ -4,14 +4,14 @@ from tests.storage import complete_specification
|
|||
import arrow
|
||||
import pytest
|
||||
|
||||
from mobilizon_bots.event.event import MobilizonEvent, EventPublicationStatus
|
||||
from mobilizon_bots.models.publication import PublicationStatus, Publication
|
||||
from mobilizon_bots.models.publisher import Publisher
|
||||
from mobilizon_bots.publishers.coordinator import (
|
||||
from mobilizon_reshare.event.event import MobilizonEvent, EventPublicationStatus
|
||||
from mobilizon_reshare.models.publication import PublicationStatus, Publication
|
||||
from mobilizon_reshare.models.publisher import Publisher
|
||||
from mobilizon_reshare.publishers.coordinator import (
|
||||
PublisherCoordinatorReport,
|
||||
PublicationReport,
|
||||
)
|
||||
from mobilizon_bots.storage.query import (
|
||||
from mobilizon_reshare.storage.query import (
|
||||
get_publishers,
|
||||
update_publishers,
|
||||
save_publication_report,
|
||||
|
|
Loading…
Reference in New Issue