This document explains the tests for the PyOpenBadges library. These tests verify that everything works correctly.
A test is like a verification. It ensures that a part of the code does what it's supposed to do.
Profiles are used to represent people or organizations that create badges.
This test verifies that a profile can be created with just:
- an identifier (URL)
- a type
- a name
This test verifies that a profile can be created with all information:
- identifier, type, name
- description
- image
- address
- email, phone
- website
This test verifies that errors appear when:
- required information is missing
- incorrect information is provided (such as a badly formatted email address)
This test verifies that a profile can be transformed into JSON-LD format (a standard format for the internet).
This test verifies that the validation function:
- accepts valid profiles
- rejects invalid profiles
- detects errors in incorrect profiles
Badges are the rewards that can be earned.
This test verifies that a badge can be created with just:
- an identifier
- a type
- a name
- an issuer (the person who gives the badge)
This test verifies that a badge can be created with all possible information:
- identifier, type, name
- description
- image
- criteria for earning the badge
- tags
- alignment with standards
This test verifies that a badge can be created by referencing an issuer:
- by its URL
- or by using the issuer object directly
This test verifies that errors appear when the rules for creating a badge are not followed.
This test verifies that a badge can be transformed into JSON-LD format.
This test verifies that the validation function correctly detects valid and invalid badges.
Credentials are documents that prove a person has received a badge.
This test verifies that a credential can be created with just the essential information.
This test verifies that a credential can be created with all possible information:
- identifier, type
- issuer
- issuance date
- expiration date
- recipient
- badge
- evidence
This test verifies that references can be made to an issuer, a badge, and a recipient.
This test verifies that errors appear when the information is not correct.
This test verifies that a credential can be transformed into JSON-LD format.
This test verifies that the is_valid() method works correctly.
This test verifies that the validation function correctly detects valid and invalid credentials.
Endorsements are documents that show a person or organization approves a badge.
This test verifies that an endorsement can be created with just the essential information.
This test verifies that an endorsement can be created with all possible information.
This test verifies that the following can be endorsed:
- a badge
- a credential
- an issuer
- another endorsement
This test verifies that errors appear when the information is not correct.
This test verifies that an endorsement can be transformed into JSON-LD format.
This test verifies that the is_valid() method works correctly.
This test verifies that the validation function correctly detects valid and invalid endorsements.
Cryptographic features help make sure badges are secure and can be trusted.
This test verifies that the library can create secure keys for signing badges.
This test verifies that keys can be saved to files and loaded back correctly.
This test verifies that a digital proof can be created to make a badge secure.
This test verifies that a credential can be signed with a private key.
This test verifies that a signature can be checked with a public key.
This test verifies that the library can detect when someone changes a signed credential.
This test verifies that the credential model can directly sign itself.
This test verifies that the credential model can verify its own signature.
This test verifies the entire process from key generation to signature verification works together.
This test verifies that signed credentials can be saved as JSON correctly.
In total, there are 48 tests that verify all parts of the PyOpenBadges library work correctly. These tests help us ensure that the library does what it's supposed to do.