예제 #1
0
    def test___init__no_params(self):
        # if  backplane is not running, start one for all the tests
        for pid in psutil.pids():
            p = psutil.Process(pid)
            if p.name() == "backplane":
                break
            else:
                self.proc = Popen(['backplane'],
                                  stdin=subprocess.PIPE,
                                  stderr=subprocess.PIPE,
                                  stdout=subprocess.PIPE)
                break

        b = BanyanBase()
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        # use the google dns
        try:
            s.connect(('8.8.8.8', 1))
            back_plane_ip_address = s.getsockname()[0]
        except:
            back_plane_ip_address = '127.0.0.1'
        finally:
            s.close()

        b.clean_up()
        assert b.back_plane_ip_address == back_plane_ip_address
예제 #2
0
 def test_set_subscriber_topic_invalid(self):
     b = BanyanBase()
     try:
         b.set_subscriber_topic(8)
         assert False
     except TypeError:
         b.clean_up()
         assert True
예제 #3
0
 def test_numpy_publish_payload_valid_topic(self):
     b = BanyanBase(numpy=True)
     try:
         b.publish_payload({'payload': 1}, 'b')
         b.clean_up()
         assert True
     except TypeError:
         b.clean_up()
         assert False
예제 #4
0
 def test_publish_payload_invalid_topic(self):
     b = BanyanBase()
     try:
         b.publish_payload({'payload': 1}, ['b'])
         b.clean_up()
         assert False
     except TypeError:
         b.clean_up()
         assert True
예제 #5
0
 def test___init__specify_backplane_address(self):
     b = BanyanBase('111.222.333.444')
     b.clean_up()
     assert b.back_plane_ip_address == '111.222.333.444'
예제 #6
0
 def test_clean_up(self):
     b = BanyanBase()
     b.clean_up()
     assert True
예제 #7
0
 def test_incoming_message_processing(self):
     b = BanyanBase()
     b.incoming_message_processing({'payload': 1}, 'the_topic')
     b.clean_up()
     assert True