Пример #1
0
  def test_empty_document(self):
    """
    Parse a document without any router status entries.
    """

    document = BridgeNetworkStatusDocument(b'published 2012-06-01 04:07:04')
    self.assertEqual(datetime.datetime(2012, 6, 1, 4, 7, 4), document.published)
    self.assertEqual({}, document.routers)
    self.assertEqual([], document.get_unrecognized_lines())
Пример #2
0
  def test_empty_document(self):
    """
    Parse a document without any router status entries.
    """

    document = BridgeNetworkStatusDocument(b'published 2012-06-01 04:07:04')
    self.assertEqual(datetime.datetime(2012, 6, 1, 4, 7, 4), document.published)
    self.assertEqual({}, document.routers)
    self.assertEqual([], document.get_unrecognized_lines())
    self.assertEqual('@type bridge-network-status 1.0', str(document.type_annotation()))
Пример #3
0
    def test_empty_document(self):
        """
    Parse a document without any router status entries.
    """

        document = BridgeNetworkStatusDocument(
            b"published 2012-06-01 04:07:04")
        self.assertEqual(datetime.datetime(2012, 6, 1, 4, 7, 4),
                         document.published)
        self.assertEqual({}, document.routers)
        self.assertEqual([], document.get_unrecognized_lines())
Пример #4
0
  def test_document(self):
    """
    Parse a document with router status entries.
    """

    document = BridgeNetworkStatusDocument(DOCUMENT)
    self.assertEqual(datetime.datetime(2012, 6, 1, 4, 7, 4), document.published)

    self.assertEqual(2, len(document.routers))
    self.assertEqual(set(['Unnamed', 'TolFuin']), set([desc.nickname for desc in document.routers.values()]))
    self.assertEqual([], document.get_unrecognized_lines())
Пример #5
0
  def test_document(self):
    """
    Parse a document with router status entries.
    """

    document = BridgeNetworkStatusDocument(DOCUMENT)
    self.assertEqual(datetime.datetime(2012, 6, 1, 4, 7, 4), document.published)

    self.assertEqual(2, len(document.routers))
    self.assertEqual(set(['Unnamed', 'TolFuin']), set([desc.nickname for desc in document.routers.values()]))
    self.assertEqual([], document.get_unrecognized_lines())
Пример #6
0
  def test_document(self):
    """
    Parse a document with router status entries.
    """

    document = BridgeNetworkStatusDocument(DOCUMENT)
    self.assertEqual(datetime.datetime(2012, 6, 1, 4, 7, 4), document.published)

    self.assertEqual(2, len(document.routers))
    self.assertEqual("Unnamed", document.routers[0].nickname)
    self.assertEqual("TolFuin", document.routers[1].nickname)
    self.assertEqual([], document.get_unrecognized_lines())