diff --git a/.gitignore b/.gitignore index dd5d326..025a8f4 100644 --- a/.gitignore +++ b/.gitignore @@ -34,4 +34,6 @@ nosetests.xml .project .pydevproject -.idea \ No newline at end of file +.idea +.vagrant +!.vagrant/provision.sh \ No newline at end of file diff --git a/.vagrant/provision.sh b/.vagrant/provision.sh new file mode 100644 index 0000000..733167b --- /dev/null +++ b/.vagrant/provision.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +export DEBIAN_FRONTEND noninteractive +echo "APT::Get::Install-Recommends \"0\";" >> /etc/apt/apt.conf.d/99local +echo "APT::Get::Install-Suggests \"0\";" >> /etc/apt/apt.conf.d/99local +echo 'DPkg::Post-Invoke {"/bin/rm -f /var/cache/apt/archives/*.deb || true";};' | tee /etc/apt/apt.conf.d/no-cache +apt-get -qq update +apt-get install -y python-software-properties +add-apt-repository ppa:mumble/release +apt-get -qq update +apt-get install -y mumble-server python-zeroc-ice zeroc-ice +sed -i 's/^icesecretwrite=$/icesecretwrite=test/g' /etc/mumble-server.ini +/etc/init.d/mumble-server restart \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..8b72d0e --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,7 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "base" + config.vm.provision :shell, :path => ".vagrant/provision.sh" +end diff --git a/mumble/__init__.py b/mumble/__init__.py index a2f98fe..25a8a2c 100644 --- a/mumble/__init__.py +++ b/mumble/__init__.py @@ -1,3 +1,5 @@ from .meta import Meta from .hooks import * -from .server import Server \ No newline at end of file +from .server import Server + +__version__ = '0.1.0' \ No newline at end of file diff --git a/setup.py b/setup.py index e135e9e..d47e19a 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # coding=utf-8 from setuptools import setup, find_packages @@ -7,7 +8,7 @@ DESCRIPTION = 'Python Mumble for Humans™' with open('README.md') as f: LONG_DESCRIPTION = f.read() -VERSION = '0.1.0' +from mumble import __version__ as VERSION setup( name='mumble', diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..87eaf32 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1 @@ +__author__ = 'nikdoof' diff --git a/tests/test_mumble.py b/tests/test_mumble.py new file mode 100644 index 0000000..ace9ba1 --- /dev/null +++ b/tests/test_mumble.py @@ -0,0 +1,33 @@ +import unittest +import mumble +import Ice + + +class ChannelTests(unittest.TestCase): + + def setUp(self): + self.meta = mumble.Meta('test') + self.server = self.meta.get_server(1) + + def tearDown(self): + for chan in self.server.get_channels(): + if chan.id != 0: + chan.delete() + + def testGetRoot(self): + chan = self.server.get_channel(0) + self.assertEqual(chan.id, 0) + self.assertEqual(chan.name, 'Root') + self.assertEqual(chan.parent, None) + self.assertEqual(chan.description, '') + self.assertEqual(chan.links, []) + self.assertEqual(chan.position, 0) + self.assertEqual(chan.temporary, False) + + def testChannelSetting(self): + channel_id = self.server.add_channel('channelSetting', 0) + chan = self.server.get_channel(channel_id) + self.assertEqual(chan.name, 'channelSetting') + chan.update(name='channelSetting1') + self.assertEqual(chan.name, 'channelSetting1') +