-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from esnet-security/topic/chriscummings/SCRAM-…
…56/add-some-tests tests: add coverage and fix ci
- Loading branch information
Showing
11 changed files
with
100 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
""" | ||
This module holds all of the exceptions we want to raise in our translators. | ||
""" | ||
|
||
|
||
class ASNError(TypeError): | ||
""" | ||
ASNError provides an error class to use when there is an issue with an Autonomous System Number. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
This module provides a location for code that we want to share between all translators. | ||
""" | ||
|
||
from exceptions import ASNError | ||
|
||
|
||
def asn_is_valid(asn: int) -> bool: | ||
""" | ||
asn_is_valid makes sure that an ASN passed in is a valid 2 or 4 Byte ASN. | ||
Args: | ||
asn (int): The Autonomous System Number that we want to validate | ||
Raises: | ||
ASNError: If the ASN is not between 0 and 4294967295 or is not an integer. | ||
Returns: | ||
bool: _description_ | ||
""" | ||
if not isinstance(asn, int): | ||
raise ASNError(f"ASN {asn} is not an Integer, has type {type(asn)}") | ||
if not 0 < asn < 4294967295: | ||
# This is the max as stated in rfc6996 | ||
raise ASNError(f"ASN {asn} is out of range. Must be between 0 and 4294967295") | ||
|
||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
|
||
def before_all(context): | ||
context.gobgp = GoBGP("gobgp:50051") | ||
context.config.setup_logging() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters