Add a basic testing framework using Vagrant.

This commit is contained in:
2013-11-06 23:24:36 +00:00
parent 49ccea5e77
commit 0d10a77ad2
7 changed files with 62 additions and 3 deletions

2
.gitignore vendored
View File

@@ -35,3 +35,5 @@ nosetests.xml
.pydevproject
.idea
.vagrant
!.vagrant/provision.sh

13
.vagrant/provision.sh Normal file
View File

@@ -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

7
Vagrantfile vendored Normal file
View File

@@ -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

View File

@@ -1,3 +1,5 @@
from .meta import Meta
from .hooks import *
from .server import Server
__version__ = '0.1.0'

View File

@@ -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',

1
tests/__init__.py Normal file
View File

@@ -0,0 +1 @@
__author__ = 'nikdoof'

33
tests/test_mumble.py Normal file
View File

@@ -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')