コード例 #1
0
 def test_it_returns_none_on_db_error(self, nycdb):
     with patch.object(HPDRegistration.objects,
                       'from_pad_bbl') as fpbblmock:
         fpbblmock.side_effect = DatabaseError()
         with patch('nycdb.models.logger.exception') as loggermock:
             assert get_management_company('1234567890') is None
             loggermock.assert_called_once_with(
                 f'Error while retrieving data from NYCDB')
コード例 #2
0
 def test_it_returns_company_on_success(self, nycdb):
     medium = fixtures.load_hpd_registration("medium-landlord.json")
     mgmtco = get_management_company(medium.pad_bbl)
     assert isinstance(mgmtco, Company)
     assert mgmtco.name == "FUNKY APARTMENT MANAGEMENT"
コード例 #3
0
 def test_it_returns_none_if_pad_bbl_does_not_exist(self, nycdb):
     assert get_management_company('1234567890') is None
コード例 #4
0
 def test_it_returns_none_if_nycdb_is_disabled(self):
     assert get_management_company('') is None