about summary refs log tree commit diff stats
path: root/pkgs/by-name/up/update-vim-plugins/update_vim_plugins/tests/test_nix.py
blob: 46e59f764faa9b0fb5991f50b3358d4f77052b3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from update_vim_plugins.nix import GitSource, License, UrlSource


def test_url_source(url_source: UrlSource, url: str, sha256: str):
    assert url_source.url == url
    assert url_source.sha256 == sha256


def test_url_source_nix_expression(url_source: UrlSource, url: str, sha256: str):
    assert url_source.get_nix_expression() == f'fetchurl {{ url = "{url}"; sha256 = "{sha256}"; }}'


def test_git_source(git_source: GitSource, url: str, rev: str, sha256: str):
    assert git_source.url == url
    assert git_source.sha256 == sha256
    assert git_source.rev == rev


def test_git_source_nix_expression(git_source: GitSource, url: str, rev: str, sha256: str):
    assert git_source.get_nix_expression() == f'fetchgit {{ url = "{url}"; rev = "{rev}"; sha256 = "{sha256}"; }}'


def test_license_github():
    github_license = "MIT"
    license = License.from_spdx_id(github_license)
    assert license == License.MIT


def test_license_gitlab():
    gitlab_license = "mit"
    license = License.from_spdx_id(gitlab_license)
    assert license == License.MIT