Joystream / Joystream/joystream

Content directory smart contracts: Channels tests part 1 (w/o curator groups)

Open
#1,682 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

smart-contract-content-directory
Dominant language
Rust
Stars
1.4k
Forks
116
PR merge metrics
No merged PRs in 30d

Description

We need some preserved initial state for bridge contracts to perform those tests (see: https://github.com/Joystream/joystream/issues/1681)

Tests to include:

Success cases (valid owner access)

Creating a channel - success case (owner)

  • create a channel
  • check if event was emitted
  • check if channel exists in the storage contract

Updating channel metadata - success case (owner)

  • create a channel
  • update channel metadata
  • check if event was emitted

Updating channel owner - success case (owner)

  • create a channel
  • update channel owner
  • check if event was emitted
  • check if the owner changed in the storage

Removing a channel - success case (owner)

  • create a channel
  • remove a channel
  • check if event was emitted
  • check is channel no longer exists in the storage contract (isExisting == false)
Failure cases (invalid member access)

Creating a channel - fail case (wrong member)

  • try creating a channel as member without member access
  • verify it fails (optionally: expect specific reason)

Updating channel metadata - fail case (wrong member)

  • create a channel
  • try to update metadata using different key (without access)
  • verify it fails (optionally: expect specific reason)

Updating channel owner - fail case (wrong member)

  • create a channel
  • try to update owner using different key (without access)
  • verify it fails (optionally: expect specific reason)

Removing a channel - fail case (wrong member)

  • create a channel
  • try to remove a channel using different key (without access)
  • verify it fails (optionally: expect specific reason)
Success cases (valid curator access)

Updating channel metadata - success case (curator)

  • create a channel
  • use curator key to update channel metadata
  • assert success

Disabling/enabling a channel - success case (curator)

  • create a channel
  • use curator key to disable channel
  • check if event emitted
  • check if channel is disabled (storage)
  • use curator key to enable channel
  • check if event emitted
  • check if channel is enabled (storage)

Removing a channel - success case (curator)

  • create a channel
  • use curator key to remove a channel
  • assert success

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the preserved initial state requirement in issue 1681 and inspect the bridge contracts and channel storage contract involved here. Implement the listed owner and curator success and failure cases, including event and storage assertions. Done means all specified channel operations are covered for valid and invalid access.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.