Verified Commit 97764768 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Basic test and extension setup

parent a21c8f25
# -*- coding: utf-8 -*-
"""Top-level package for mopidy-funkwhale."""
from __future__ import unicode_literals
import logging
import mopidy.config
import mopidy.ext
import os
__author__ = """Eliot Berriot"""
__email__ = 'contact+funkwhale@eliotberriot.com'
__version__ = '0.1.0'
logger = logging.getLogger(__name__)
class Extension(mopidy.ext.Extension):
dist_name = 'Mopidy-Funkwhale'
ext_name = 'funkwhale'
version = __version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__file__), 'ext.conf')
return mopidy.config.read(conf_file)
def get_config_schema(self):
schema = super(Extension, self).get_config_schema()
schema['url'] = mopidy.config.String()
schema['username'] = mopidy.config.Secret(optional=True)
schema['password'] = mopidy.config.Secret(optional=True)
return schema
def setup(self, registry):
from .backend import FoobarBackend
registry.add('backend', FoobarBackend)
[funkwhale]
enabled = true
url = https://demo.funkwhale.audio
username = demo
password = demo
# -*- coding: utf-8 -*-
"""Main module."""
......@@ -19,14 +19,24 @@ zip_safe = True
include_package_data = True
packages = find:
install_requires =
mopidy
requests
[options.extras_require]
[options.entry_points]
mopidy.ext =
funkwhale = mopidy_funkwhale:Extension
[options.extras_require]
test =
pytest
pytest-cov
dev =
pygobject
ipython
ipdb
[options.packages.find]
exclude =
tests
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""Tests for `mopidy_funkwhale` package."""
import mopidy_funkwhale
import pytest
def test_get_default_config():
ext = mopidy_funkwhale.Extension()
from mopidy_funkwhale import mopidy_funkwhale
config = ext.get_default_config()
assert '[funkwhale]' in config
assert 'enabled = true' in config
assert 'url = https://demo.funkwhale.audio' in config
assert 'username = demo' in config
assert 'password = demo' in config
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.get('https://github.com/audreyr/cookiecutter-pypackage')
def test_get_config_schema():
ext = mopidy_funkwhale.Extension()
def test_content(response):
"""Sample pytest test function with the pytest fixture as an argument."""
# from bs4 import BeautifulSoup
# assert 'GitHub' in BeautifulSoup(response.content).title.string
schema = ext.get_config_schema()
assert 'url' in schema
assert 'username' in schema
assert 'password' in schema
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment