Source code for cannabis_reports.tests.test_apis_strains

# -*- coding: utf-8 -*-
# Copyright 2017-TODAY LasLabs Inc.
# License MIT (https://opensource.org/licenses/MIT).

from .api_common import recorder
from .api_product import ApiProductAbstract

from ..models.strain import Strain


[docs]class TestApisStrains(ApiProductAbstract): """Tests the Strains API endpoint.""" UID = 'VUJCJ4TYMG000000000000000'
[docs] def setUp(self): super(TestApisStrains, self).setUp() self.endpoint = self.api.Strains
[docs] @recorder.use_cassette() def test_apis_strains_list(self): """It should parse the response and return the proper object.""" self._test_apis_objects_list(Strain)
[docs] @recorder.use_cassette() def test_apis_strains_get(self): """It should return the proper singleton.""" self._test_apis_objects_get('Jack Herer')
[docs] @recorder.use_cassette() def test_apis_strains_get_user(self): """It should return the proper user singleton.""" self._test_apis_objects_get_user('David')
[docs] @recorder.use_cassette() def test_apis_strains_get_review(self): """It should return the reviews.""" self._test_apis_objects_get_review()
[docs] @recorder.use_cassette() def test_apis_strains_get_effects_flavors(self): """It should return the effect & flavor profile.""" self._test_apis_objects_get_effects_flavors()
[docs] @recorder.use_cassette() def test_apis_strains_get_available(self): """It should return the menu items.""" self._test_apis_objects_get_available()
[docs] @recorder.use_cassette() def test_apis_strains_get_seed_company(self): """It should return the seed company.""" seed_company = self.api.Strains.get_seed_company( 'VUJCJ4TYMG000000000000000', ) self.assertEqual(seed_company.name, 'Sensi Seeds')
[docs] @recorder.use_cassette() def test_apis_strains_get_genetics(self): """It should return the parent strains.""" genetics = self.api.Strains.get_genetics('CYGU94JYKY000000000000000') found_parent = False for genetic in genetics: self.assertIsInstance(genetic, Strain) if genetic.name == 'Afghani No. 1': found_parent = True self.assertTrue(found_parent)
[docs] @recorder.use_cassette() def test_apis_strains_get_children(self): """It should return the child strains.""" children = self.api.Strains.get_children('VUJCJ4TYMG000000000000000', limit=self.LIMIT_PAGE) found_child = False for child in children: self.assertIsInstance(child, Strain) if child.name == 'Jack Flash': found_child = True self.assertTrue(found_child)