mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
diaspora: Convert tests to pytest style
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
parent
377a50e213
commit
a195fdca57
@ -20,25 +20,21 @@ Test Apache configuration generation for diaspora*
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
|
||||||
|
|
||||||
from plinth.modules import diaspora
|
from plinth.modules import diaspora
|
||||||
|
|
||||||
|
|
||||||
class TestDiaspora(unittest.TestCase):
|
def test_generate_apache_configuration():
|
||||||
"""Test Apache configuration for Diaspora module."""
|
"""Test that Apache configuration is created properly."""
|
||||||
|
with tempfile.NamedTemporaryFile() as conf_file:
|
||||||
|
diaspora.generate_apache_configuration(conf_file.name,
|
||||||
|
'freedombox.rocks')
|
||||||
|
|
||||||
def test_generate_apache_configuration(self):
|
assert os.stat(conf_file.name).st_size != 0
|
||||||
"""Test that Apache configuration is created properly."""
|
|
||||||
with tempfile.NamedTemporaryFile() as conf_file:
|
|
||||||
diaspora.generate_apache_configuration(conf_file.name,
|
|
||||||
'freedombox.rocks')
|
|
||||||
|
|
||||||
assert os.stat(conf_file.name).st_size != 0
|
with open(conf_file.name) as file_handle:
|
||||||
|
contents = file_handle.read()
|
||||||
|
|
||||||
with open(conf_file.name) as file_handle:
|
assert all(
|
||||||
contents = file_handle.read()
|
word in contents
|
||||||
|
for word in ['VirtualHost', 'Location', 'Directory', 'assets'])
|
||||||
assert all(
|
|
||||||
word in contents
|
|
||||||
for word in ['VirtualHost', 'Location', 'Directory', 'assets'])
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user