Beispiel #1
0
    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
Beispiel #2
0
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
Beispiel #3
0
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