Commit 749c22cb authored by Jeffrey Phillips Freeman's avatar Jeffrey Phillips Freeman 💥
Browse files

Moving KissMock out into its own file.

parent ea94b0f9
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# These imports are for python3 compatability inside python2
# These imports are for python3 compatibility inside python2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# These imports are for python3 compatibility inside python2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .kiss_mock import KissMock # noqa: F401
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__email__ = 'jeffrey.freeman@syncleus.com'
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
......@@ -3,7 +3,7 @@
"""Constants for APEX Module Tests."""
# These imports are for python3 compatability inside python2
# These imports are for python3 compatibility inside python2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
......
......@@ -3,7 +3,7 @@
"""Context for tests for APRS Python Module."""
# These imports are for python3 compatability inside python2
# These imports are for python3 compatibility inside python2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# These imports are for python3 compatibility inside python2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import apex.kiss.constants
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__email__ = 'jeffrey.freeman@syncleus.com'
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2016, Syncleus, Inc. and contributors'
__credits__ = []
class KissMock(apex.kiss.Kiss):
def __init__(self,
strip_df_start=True):
super(KissMock, self).__init__(strip_df_start)
self.read_from_interface = []
self.sent_to_interface = []
def _read_interface(self):
if not len(self.read_from_interface):
return None
raw_frame = self.read_from_interface[0]
del self.read_from_interface[0]
return raw_frame
def _write_interface(self, data):
self.sent_to_interface.append(data)
def clear_interface(self):
self.read_from_interface = []
self.sent_to_interface = []
def add_read_from_interface(self, raw_frame):
self.read_from_interface.append(raw_frame)
def get_sent_to_interface(self):
return self.sent_to_interface
# These imports are for python3 compatability inside python2
# These imports are for python3 compatibility inside python2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
......
......@@ -3,7 +3,7 @@
"""Tests for Python APRS-IS Bindings."""
# These imports are for python3 compatability inside python2
# These imports are for python3 compatibility inside python2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
......
......@@ -3,7 +3,7 @@
"""Tests for KISS Util Module."""
# These imports are for python3 compatability inside python2
# These imports are for python3 compatibility inside python2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
......@@ -13,6 +13,8 @@ import unittest
import apex.kiss
import apex.kiss.constants
from .kiss_mock import KissMock
__author__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__maintainer__ = 'Jeffrey Phillips Freeman (WI2ARD)'
__email__ = 'jeffrey.freeman@syncleus.com'
......@@ -71,35 +73,5 @@ class KissUtilTestCase(unittest.TestCase):
self.assertEqual(ENCODED_FRAME, all_raw_frames[0])
class KissMock(apex.kiss.Kiss):
def __init__(self,
strip_df_start=True):
super(KissMock, self).__init__(strip_df_start)
self.read_from_interface = []
self.sent_to_interface = []
def _read_interface(self):
if not len(self.read_from_interface):
return None
raw_frame = self.read_from_interface[0]
del self.read_from_interface[0]
return raw_frame
def _write_interface(self, data):
self.sent_to_interface.append(data)
def clear_interface(self):
self.read_from_interface = []
self.sent_to_interface = []
def add_read_from_interface(self, raw_frame):
self.read_from_interface.append(raw_frame)
def get_sent_to_interface(self):
return self.sent_to_interface
if __name__ == '__main__':
unittest.main()
......@@ -3,7 +3,7 @@
"""Tests for Python APRS util methods."""
# These imports are for python3 compatability inside python2
# These imports are for python3 compatibility inside python2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment