Commit Graph

2 Commits (master)

Author SHA1 Message Date
Aravinth Manivannan 820b19d114
chore: refactor: use dataclasses for entities
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-09-19 20:00:50 +05:30
Aravinth Manivannan 9cac98368b
feat: validate with user and org policy and tests
ci/woodpecker/push/woodpecker Pipeline failed Details
COMPONENTS

    FORGE
	API client to interact with target forge, for which
	shared-hosting is provided. Base class and Gitea implementation
	in check/forge.py

    PAYMENT VALIDATOR
	API client to interact with payments backed. It tells if a user
	is a paying customer or not. Defined in check/payment.py

    ALERT
	Alerting API that is called when a policy violation is
	discovered. Defined in check/alert.py

	An alert will include a message code and related data. All types
	of alerts should have unique message codes.

	WARNING
	    Using an undefined message code will result in raise
	    exceptions

    POLICY
	Features that are available to paying customers only. Defined in
	check/policy.py

USER POLICY
    - Only paying customers are allowed to create non-fork repositories
    - Non-paying customers are allowed to fork paying customers'
      repositories
    - Forks chain should contain at least one paying customer

ORG POLICY
    - At least 50% members of an organisation should be paying customers

TESTING STRATEGY
    Tests use dummy substitutes for `forge` API client, `payment
    validator` and the `alert` client.

    DATA
	- Test forge data is hard-coded and verified in
	  check/tests/test_forge.py.
	- Paying customer information is hard-coded in test_factory

    We run policies using this data and verify results
2022-09-19 00:34:38 +05:30