Initial upload: DevDash CLI with TUI dashboard
Some checks failed
CI / test (push) Has been cancelled
Some checks failed
CI / test (push) Has been cancelled
This commit is contained in:
61
tests/test_models.py
Normal file
61
tests/test_models.py
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import pytest
|
||||||
|
from src.models.entities import Repository, PullRequest, Issue, Workflow, Config
|
||||||
|
from src.models.types import Provider, IssueStatus, WorkflowStatus, PRStatus
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
class TestRepository:
|
||||||
|
def test_create_repository(self):
|
||||||
|
repo = Repository(
|
||||||
|
name="test-repo",
|
||||||
|
owner="testuser",
|
||||||
|
full_name="testuser/test-repo",
|
||||||
|
provider=Provider.GITHUB,
|
||||||
|
)
|
||||||
|
assert repo.name == "test-repo"
|
||||||
|
assert repo.owner == "testuser"
|
||||||
|
assert repo.provider == Provider.GITHUB
|
||||||
|
|
||||||
|
|
||||||
|
class TestPullRequest:
|
||||||
|
def test_create_pull_request(self):
|
||||||
|
pr = PullRequest(
|
||||||
|
number=1,
|
||||||
|
title="Test PR",
|
||||||
|
author="testuser",
|
||||||
|
status=PRStatus.OPEN,
|
||||||
|
)
|
||||||
|
assert pr.number == 1
|
||||||
|
assert pr.title == "Test PR"
|
||||||
|
assert pr.status == PRStatus.OPEN
|
||||||
|
|
||||||
|
|
||||||
|
class TestIssue:
|
||||||
|
def test_create_issue(self):
|
||||||
|
issue = Issue(
|
||||||
|
number=1,
|
||||||
|
title="Test Issue",
|
||||||
|
author="testuser",
|
||||||
|
status=IssueStatus.OPEN,
|
||||||
|
)
|
||||||
|
assert issue.number == 1
|
||||||
|
assert issue.status == IssueStatus.OPEN
|
||||||
|
|
||||||
|
|
||||||
|
class TestWorkflow:
|
||||||
|
def test_create_workflow(self):
|
||||||
|
workflow = Workflow(
|
||||||
|
id=1,
|
||||||
|
name="CI",
|
||||||
|
status=WorkflowStatus.SUCCESS,
|
||||||
|
)
|
||||||
|
assert workflow.id == 1
|
||||||
|
assert workflow.status == WorkflowStatus.SUCCESS
|
||||||
|
|
||||||
|
|
||||||
|
class TestConfig:
|
||||||
|
def test_default_config(self):
|
||||||
|
config = Config()
|
||||||
|
assert config.refresh_interval == 30
|
||||||
|
assert config.theme == "dark"
|
||||||
|
assert config.github_token is None
|
||||||
Reference in New Issue
Block a user