Exemplo n.º 1
0
 def test_id_missing(self) -> None:
     """Test exception on missing source `id`."""
     with pytest.raises(NotFound):
         Source.from_id(-1)
Exemplo n.º 2
0
 def test_relationship_source_type(self, testdata: TestData) -> None:
     """Test source foreign key relationship on source_type."""
     for i, record in enumerate(testdata['source']):
         assert Source.from_id(i + 1).type.id == record['type_id']
Exemplo n.º 3
0
 def test_from_id(self, testdata: TestData) -> None:
     """Test loading source from `id`."""
     # NOTE: `id` not set until after insert
     for i, record in enumerate(testdata['source']):
         assert Source.from_id(i + 1).name == record['name']
Exemplo n.º 4
0
 def test_relationship_source_type(self, testdata: TestData) -> None:
     """Test observation foreign key relationship on source -> source_type."""
     for i, record in enumerate(testdata['observation']):
         assert Observation.from_id(i + 1).source.type.id == Source.from_id(record['source_id']).type.id