aboutsummaryrefslogtreecommitdiff
path: root/examples/vndor/constant_gen/verify_licenses_test.py
blob: 917e6007a008bf5cadbda6958e75423069b28807 (plain)
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
33
34
35
36
37
38
39
40
"""Test that we see the expected licenses for some generated code."""

import codecs
import os

import unittest
from tests import license_test_utils

class VerifyLicensesTest(unittest.TestCase):

  def test_generater_license(self):
    licenses_info = license_test_utils.load_licenses_info(
        os.path.join(os.path.dirname(__file__), "generator_licenses.json"))

    expected = {
        "examples/vndor/constant_gen:constant_generator": [
            "examples/vndor/constant_gen:license"
        ],
    }
    license_test_utils.check_licenses_of_dependencies(
        self, licenses_info, expected)

  def test_generated_code_license(self):
    licenses_info = license_test_utils.load_licenses_info(
        os.path.join(os.path.dirname(__file__), "generated_code_licenses.json"))

    expected = {
        "examples/vndor/constant_gen:libhello": [
            "/constant_gen:license_for_emitted_code",
        ],
        "examples/vndor/constant_gen:libhello_src_": [
            "/constant_gen:license_for_emitted_code",
        ],
    }
    license_test_utils.check_licenses_of_dependencies(
        self, licenses_info, expected)

if __name__ == "__main__":
  unittest.main()