# Path: capirca/lib/gcp.py
# class Error(Exception):
# class TermError(Error):
# class HeaderError(Error):
# class UnsupportedFilterTypeError(Error):
# class Term(aclgenerator.Term):
# class GCP(aclgenerator.ACLGenerator):
#   _ALLOW_PROTO_NAME = frozenset(
#       ['tcp', 'udp', 'icmp', 'esp', 'ah', 'ipip', 'sctp',
#        'all'
#       ])
#   _GOOD_DIRECTION = ['INGRESS', 'EGRESS']
#   def _GetPorts(self):
#   def _GetLoggingSetting(self):
#   def __str__(self):
# def IsDefaultDeny(term):
# def IsProjectIDValid(project):
# def IsVPCNameValid(vpc):
# def TruncateString(raw_string, max_length):
# def GetIpv6TermName(term_name):


from absl.testing import absltest
from absl.testing import parameterized
from capirca.lib import gcp
"""Unittest for GCP Firewall Generator module."""





class HelperFunctionsTest(parameterized.TestCase):

  @parameterized.named_parameters(
      ('lowercase', 'project'),
      ('lowercase_w_hyphen', 'project-id'),
      ('lowercase_w_numbers', 'project123'),
      ('lowercase_w_numbers_hyphens', 'project-1-2-3'))
  def testIsProjectIDValidPasses(self, project):
    self.assertTrue(gcp.IsProjectIDValid(project))

  @parameterized.named_parameters(
      ('trailing_hyphen', 'project-'),
      ('start_w_number', '1project'),
      ('start_w_hyphen', '-project'),
      ('uppercase', 'Project'),
      ('too_short_by_one_char', 'proje'),
      ('too_long_by_one_char', 31 * 'a'))
  def testIsProjectIDValidFails(self, project):

# Path: capirca/lib/gcp.py
# class Error(Exception):
# class TermError(Error):
# class HeaderError(Error):
# class UnsupportedFilterTypeError(Error):
# class Term(aclgenerator.Term):
# class GCP(aclgenerator.ACLGenerator):
#   _ALLOW_PROTO_NAME = frozenset(
#       ['tcp', 'udp', 'icmp', 'esp', 'ah', 'ipip', 'sctp',
#        'all'
#       ])
#   _GOOD_DIRECTION = ['INGRESS', 'EGRESS']
#   def _GetPorts(self):
#   def _GetLoggingSetting(self):
#   def __str__(self):
# def IsDefaultDeny(term):
# def IsProjectIDValid(project):
# def IsVPCNameValid(vpc):
# def TruncateString(raw_string, max_length):
# def GetIpv6TermName(term_name):


# Path: tests/lib/gcp_test.py
from absl.testing import absltest
from absl.testing import parameterized
from capirca.lib import gcp

"""Unittest for GCP Firewall Generator module."""





class HelperFunctionsTest(parameterized.TestCase):

  @parameterized.named_parameters(
      ('lowercase', 'project'),
      ('lowercase_w_hyphen', 'project-id'),
      ('lowercase_w_numbers', 'project123'),
      ('lowercase_w_numbers_hyphens', 'project-1-2-3'))
  def testIsProjectIDValidPasses(self, project):
    self.assertTrue(gcp.IsProjectIDValid(project))

  @parameterized.named_parameters(
      ('trailing_hyphen', 'project-'),
      ('start_w_number', '1project'),
      ('start_w_hyphen', '-project'),
      ('uppercase', 'Project'),
      ('too_short_by_one_char', 'proje'),
      ('too_long_by_one_char', 31 * 'a'))
  def testIsProjectIDValidFails(self, project):

    self.assertFalse(gcp.IsProjectIDValid(project))