forked from CapivaraProjects/repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlantRepository_test.py
More file actions
26 lines (21 loc) · 908 Bytes
/
PlantRepository_test.py
File metadata and controls
26 lines (21 loc) · 908 Bytes
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
from PlantRepository import PlantRepository
import models.Plant
plantRep = PlantRepository(
'capivara',
'test',
'127.0.0.1',
'5432',
'green_eyes')
def test_search():
plants = plantRep.search(plant=models.Plant.Plant(scientificName="ria"))
print('return {0} lines'.format(len(plants)))
assert 'ria' in plants['content'][0].scientificName
def test_insert():
plant = plantRep.create(models.Plant.Plant(0,'Malus domestica','Apple test'))
assert plant.commonName == 'Apple test'
def test_update():
plant = plantRep.update(models.Plant.Plant(0, 'Malus domestica','Apple test update'))
assert plant.commonName == 'Apple test update'
def test_delete():
result = plantRep.delete(models.Plant.Plant(0, 'Malus domestica','Apple test'))
assert result is True