# Path: cum/config.py
# class BaseConfig(object):
# class MadokamiConfig(object):
#     def __init__(self):
#     def __setattr__(self, name, value):
#     def default_download_directory(self):
#     def load(self):
#     def serialize(self):
#     def write(self):
#     def __init__(self, config, dict):
#     def login(self):
# def get():
# def initialize(directory=None):


from cum import config
from unittest import mock
import cumtest
import os

    @cumtest.skipIfNoMadokamiLogin
    def test_follow_non_unique_alias(self):
        URLS = ['https://kobato.hologfx.com/reader/series/new_game/',
                'https://manga.madokami.al/Manga/N/NE/NEW_/New%20Game%21']
        ALIASES = ['new-game', 'new-game-1']
        MESSAGES = ['Adding follow for New Game! (new-game)',
                    'Adding follow for New Game! (new-game-1)']

        for index in range(len(URLS)):
            result = self.invoke('follow', URLS[index])
            self.assertEqual(result.exit_code, 0)
            self.assertIn(MESSAGES[index], result.output)

        follows = self.db.session.query(self.db.Series).all()
        self.assertEqual(len(follows), len(URLS))
        for alias in ALIASES:
            self.assertIn(alias, [x.alias for x in follows])

    @cumtest.skipIfNoMadokamiLogin
    def test_follow_non_unique_alias_with_unfollow(self):
        URLS = ['https://kobato.hologfx.com/reader/series/new_game/',
                'https://manga.madokami.al/Manga/N/NE/NEW_/New%20Game%21']
        ALIASES = ['new-game', 'new-game-1']
        MESSAGE = 'Adding follow for New Game! (new-game)'

        result = self.invoke('follow', URLS[0])
        self.assertEqual(result.exit_code, 0)
        self.assertIn(MESSAGE, result.output)


# Path: cum/config.py
# class BaseConfig(object):
# class MadokamiConfig(object):
#     def __init__(self):
#     def __setattr__(self, name, value):
#     def default_download_directory(self):
#     def load(self):
#     def serialize(self):
#     def write(self):
#     def __init__(self, config, dict):
#     def login(self):
# def get():
# def initialize(directory=None):


# Path: tests/test_cli_follow.py
from cum import config
from unittest import mock
import cumtest
import os


    @cumtest.skipIfNoMadokamiLogin
    def test_follow_non_unique_alias(self):
        URLS = ['https://kobato.hologfx.com/reader/series/new_game/',
                'https://manga.madokami.al/Manga/N/NE/NEW_/New%20Game%21']
        ALIASES = ['new-game', 'new-game-1']
        MESSAGES = ['Adding follow for New Game! (new-game)',
                    'Adding follow for New Game! (new-game-1)']

        for index in range(len(URLS)):
            result = self.invoke('follow', URLS[index])
            self.assertEqual(result.exit_code, 0)
            self.assertIn(MESSAGES[index], result.output)

        follows = self.db.session.query(self.db.Series).all()
        self.assertEqual(len(follows), len(URLS))
        for alias in ALIASES:
            self.assertIn(alias, [x.alias for x in follows])

    @cumtest.skipIfNoMadokamiLogin
    def test_follow_non_unique_alias_with_unfollow(self):
        URLS = ['https://kobato.hologfx.com/reader/series/new_game/',
                'https://manga.madokami.al/Manga/N/NE/NEW_/New%20Game%21']
        ALIASES = ['new-game', 'new-game-1']
        MESSAGE = 'Adding follow for New Game! (new-game)'

        result = self.invoke('follow', URLS[0])
        self.assertEqual(result.exit_code, 0)
        self.assertIn(MESSAGE, result.output)


        result = self.invoke('unfollow', ALIASES[0])