def get(self, mine_guid): variances = Variance.find_by_mine_guid(mine_guid) if variances is None: raise BadRequest( 'Unable to fetch variances. Confirm you\'ve provided a valid mine_guid') if len(variances) == 0: mine = Mine.find_by_mine_guid(mine_guid) if mine is None: raise NotFound('Mine') return variances
def test_variance_model_find_by_mine_guid_invalid(db_session): with pytest.raises(AssertionError) as e: variances = Variance.find_by_mine_guid('jflkjfsdl') assert str(e.value) == INVALID_MINE_GUID
def test_variance_model_find_by_mine_guid(db_session): init_mine_guid = VarianceFactory().mine_guid variances = Variance.find_by_mine_guid(init_mine_guid) assert variances[0].mine_guid == init_mine_guid