-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_smsshell_transmitter_python_gammu.py
More file actions
42 lines (34 loc) · 1.31 KB
/
Copy pathtest_smsshell_transmitter_python_gammu.py
File metadata and controls
42 lines (34 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf8 -*-
import configparser
import pytest
import os
import SMSShell
import SMSShell.transmitters.python_gammu
def test_init():
transmitter = SMSShell.transmitters.python_gammu.Transmitter()
def test_without_gammurc():
transmitter = SMSShell.transmitters.python_gammu.Transmitter()
assert not transmitter.start()
def test_without_bad_configuration():
config = dict(umask='9')
transmitter = SMSShell.transmitters.python_gammu.Transmitter(config=config)
assert not transmitter.start()
def test_without_read_right():
config = dict(umask='9', smsdrc_configuration='/root')
transmitter = SMSShell.transmitters.python_gammu.Transmitter(config=config)
assert not transmitter.start()
def test_simple_transmit():
"""Test base parser class exception
"""
smsdrc = configparser.ConfigParser()
smsdrc['gammu'] = dict(Device='/dev/null')
smsdrc['smsd'] = dict(Service='FILES')
with open('tests/smsdrc', 'w') as w:
smsdrc.write(w)
config = dict(umask='9', smsdrc_configuration=os.path.join(os.getcwd(), 'tests/smsdrc'))
transmitter = SMSShell.transmitters.python_gammu.Transmitter(config=config)
transmitter.start()
message = SMSShell.models.Message('local', 'OK')
transmitter.transmit(message)
transmitter.stop()
#os.unlink('tests/smsdrc')