def test_proceeding_line(self):
        """
    Includes a line prior to the 'rendezvous-service-descriptor' entry.
    """

        expect_invalid_attr_for_text(
            self, b'hibernate 1\n' + HiddenServiceDescriptor.content())
    def test_trailing_line(self):
        """
    Includes a line after the 'router-signature' entry.
    """

        expect_invalid_attr_for_text(
            self,
            HiddenServiceDescriptor.content() + b'\nhibernate 1')
  def test_required_fields(self):
    """
    Check that we require the mandatory fields.
    """

    line_to_attr = {
      'rendezvous-service-descriptor': 'descriptor_id',
      'version': 'version',
      'permanent-key': 'permanent_key',
      'secret-id-part': 'secret_id_part',
      'publication-time': 'published',
      'introduction-points': 'introduction_points_encoded',
      'protocol-versions': 'protocol_versions',
      'signature': 'signature',
    }

    for line in REQUIRED_FIELDS:
      desc_text = HiddenServiceDescriptor.content(exclude = (line,))

      expected = [] if line == 'protocol-versions' else None
      expect_invalid_attr_for_text(self, desc_text, line_to_attr[line], expected)
  def test_required_fields(self):
    """
    Check that we require the mandatory fields.
    """

    line_to_attr = {
      'rendezvous-service-descriptor': 'descriptor_id',
      'version': 'version',
      'permanent-key': 'permanent_key',
      'secret-id-part': 'secret_id_part',
      'publication-time': 'published',
      'introduction-points': 'introduction_points_encoded',
      'protocol-versions': 'protocol_versions',
      'signature': 'signature',
    }

    for line in REQUIRED_FIELDS:
      desc_text = HiddenServiceDescriptor.content(exclude = (line,))

      expected = [] if line == 'protocol-versions' else None
      expect_invalid_attr_for_text(self, desc_text, line_to_attr[line], expected)
  def test_trailing_line(self):
    """
    Includes a line after the 'router-signature' entry.
    """

    expect_invalid_attr_for_text(self, HiddenServiceDescriptor.content() + b'\nhibernate 1')
  def test_proceeding_line(self):
    """
    Includes a line prior to the 'rendezvous-service-descriptor' entry.
    """

    expect_invalid_attr_for_text(self, b'hibernate 1\n' + HiddenServiceDescriptor.content())