|
1 | 1 | from pytest import mark
|
2 | 2 |
|
3 | 3 | from seedcase_sprout import (
|
4 |
| - ContributorProperties, |
5 |
| - LicenseProperties, |
6 | 4 | PackageProperties,
|
7 |
| - ResourceProperties, |
8 | 5 | as_readme_text,
|
| 6 | + example_package_properties, |
| 7 | + example_resource_properties_all_types, |
9 | 8 | )
|
10 | 9 |
|
11 | 10 |
|
12 | 11 | def test_creates_readme():
|
13 |
| - """Should be able to create a README for a set of properties.""" |
14 |
| - properties = PackageProperties( |
15 |
| - name="diabetes-hypertension-study", |
16 |
| - title="Diabetes and Hypertension Study", |
17 |
| - homepage="www.my-page.com/diabetes-2021", |
18 |
| - id="123-abc-123", |
19 |
| - description="This is my package.", |
20 |
| - version="2.0.0", |
21 |
| - created="2024-05-14T05:00:01+00:00", |
22 |
| - contributors=[ |
23 |
| - ContributorProperties( |
24 |
| - title="Jamie Jones", |
25 |
| - |
26 |
| - path="example.com/jamie_jones", |
27 |
| - roles=["creator"], |
28 |
| - ) |
29 |
| - ], |
30 |
| - resources=[ |
31 |
| - ResourceProperties( |
32 |
| - title="First Resource", description="This is my first resource." |
33 |
| - ), |
34 |
| - ResourceProperties( |
35 |
| - title="Second Resource", description="This is my second resource." |
36 |
| - ), |
37 |
| - ], |
38 |
| - licenses=[ |
39 |
| - LicenseProperties( |
40 |
| - name="ODC-BY-1.0", |
41 |
| - path="https://opendatacommons.org/licenses/by", |
42 |
| - title="Open Data Commons Attribution License 1.0", |
43 |
| - ), |
44 |
| - LicenseProperties( |
45 |
| - name="APL-1.0", |
46 |
| - path="https://opensource.org/license/apl1-0-php", |
47 |
| - title="Adaptive Public License 1.0", |
48 |
| - ), |
49 |
| - ], |
50 |
| - ) |
51 |
| - assert as_readme_text(properties) |
| 12 | + """Should create a README with basic information about the properties.""" |
| 13 | + properties = example_package_properties() |
| 14 | + resource = example_resource_properties_all_types() |
| 15 | + assert resource.schema |
| 16 | + assert resource.schema.fields |
| 17 | + properties.resources = [resource] |
| 18 | + |
| 19 | + readme = as_readme_text(properties) |
| 20 | + |
| 21 | + assert str(resource.title) in readme |
| 22 | + assert all([str(field.name) in readme for field in resource.schema.fields]) |
52 | 23 |
|
53 | 24 |
|
54 | 25 | def test_creates_readme_with_empty_values():
|
|
0 commit comments