Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Erin
mopidy
Commits
97764768
Verified
Commit
97764768
authored
Oct 03, 2018
by
Eliot Berriot
Browse files
Basic test and extension setup
parent
a21c8f25
Changes
6
Hide whitespace changes
Inline
Side-by-side
mopidy_funkwhale/__init__.py
View file @
97764768
# -*- 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
)
mopidy_funkwhale/ext.conf
0 → 100644
View file @
97764768
[
funkwhale
]
enabled
=
true
url
=
https
://
demo
.
funkwhale
.
audio
username
=
demo
password
=
demo
mopidy_funkwhale/mopidy_funkwhale.py
deleted
100644 → 0
View file @
a21c8f25
# -*- coding: utf-8 -*-
"""Main module."""
setup.cfg
View file @
97764768
...
...
@@ -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
...
...
tests/__init__.py
0 → 100644
View file @
97764768
tests/test_mopidy_funkwhale.py
View file @
97764768
#!/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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment