class TestRadioRunnerAuxMethods:
    def setup_method(self, method):
        self.radio = RadioRunner()

    def test_is_station_run_valid_output(self):
        radio_output = VALID_OUTPUT
        assert True == self.radio.is_station_run(radio_output)

    def test_is_station_run_invalid_output(self):
        radio_output = INVALID_OUTPUT
        with pytest.raises(BufferError):
            self.radio.is_station_run(radio_output)

    def dtest_number_of_stations(self):
        assert 32 > len(self.radio.stations)
class TestRadioRunner:
    def setup_method(self, method):
        self.radio = RadioRunner()

    def teardown_method(self, method):
        self.radio.stop_radio()

    def test_run_not_existing_radio(self):
        self.radio.stations['invalid'] = 'mplayer mms://surely.invalid.stream.com'
        with pytest.raises(BufferError):
            self.radio.run_radio('invalid')

    def test_run_radio_wrong_station(self):
        with pytest.raises(KeyError):
            self.radio.run_radio('wrong_station')

    def test_run_radio_station(self, radio_station):
        self.radio.run_radio(radio_station, TESTMODE)
示例#3
0
import sys

from radio_runner import RadioRunner

__author__ = 'adrian'

if __name__ == '__main__':
    radio = RadioRunner()
    radio.run_radio(sys.argv[1])
    radio.radio_process.wait()
 def setup_method(self, method):
     self.radio = RadioRunner()