def load_manifest(schema_type, framework_slug, lot_slug):
    loader = ContentLoader('./')
    loader.load_manifest(framework_slug,
                         MANIFESTS[schema_type]['question_set'],
                         MANIFESTS[schema_type]['manifest'])

    return loader.get_builder(framework_slug,
                              MANIFESTS[schema_type]['manifest']).filter(
                                  {'lot': lot_slug})
def load_manifest(schema_type, framework_slug, lot_slug):
    loader = ContentLoader('./')
    loader.load_manifest(
        framework_slug,
        MANIFESTS[schema_type]['question_set'],
        MANIFESTS[schema_type]['manifest']
    )

    return loader.get_builder(framework_slug, MANIFESTS[schema_type]['manifest']).filter({'lot': lot_slug})
Пример #3
0
import mock
import unittest
import datetime
from werkzeug.exceptions import NotFound

import app.helpers as helpers
from dmcontent.content_loader import ContentLoader

from dmapiclient import api_stubs

content_loader = ContentLoader('tests/fixtures/content')
content_loader.load_manifest('dos', 'data', 'edit_brief')
questions_builder = content_loader.get_builder('dos', 'edit_brief')


class TestBuyersHelpers(unittest.TestCase):
    def test_get_framework_and_lot(self):
        data_api_client = mock.Mock()
        data_api_client.get_framework.return_value = api_stubs.framework(
            slug='digital-outcomes-and-specialists',
            status='live',
            lots=[
                api_stubs.lot(slug='digital-specialists', allows_brief=True)
            ])

        framework, lot = helpers.buyers_helpers.get_framework_and_lot(
            'digital-outcomes-and-specialists', 'digital-specialists',
            data_api_client)

        assert framework['status'] == "live"
        assert framework['name'] == 'Digital Outcomes and Specialists'
import os
import json
import unittest
from mock import Mock
from dmcontent.content_loader import ContentLoader
from werkzeug.datastructures import MultiDict

from app.presenters.search_presenters import filters_for_lot, set_filter_states

content_loader = ContentLoader('tests/fixtures/content')
content_loader.load_manifest('g6', 'data', 'manifest')
questions_builder = content_loader.get_builder('g6', 'manifest')


def _get_fixture_data():
    test_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
    fixture_path = os.path.join(test_root, 'fixtures',
                                'search_results_fixture.json')
    with open(fixture_path) as fixture_file:
        return json.load(fixture_file)


def _get_fixture_multiple_pages_data():
    test_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
    fixture_path = os.path.join(test_root, 'fixtures',
                                'search_results_multiple_pages_fixture.json')
    with open(fixture_path) as fixture_file:
        return json.load(fixture_file)


class TestSearchFilters(unittest.TestCase):
import os
import json
import unittest
from mock import Mock
from dmcontent.content_loader import ContentLoader
from werkzeug.datastructures import MultiDict

from app.presenters.search_presenters import filters_for_lot, set_filter_states


content_loader = ContentLoader('tests/fixtures/content')
content_loader.load_manifest('g6', 'data', 'manifest')
questions_builder = content_loader.get_builder('g6', 'manifest')


def _get_fixture_data():
    test_root = os.path.abspath(
        os.path.join(os.path.dirname(__file__), "..")
    )
    fixture_path = os.path.join(
        test_root, 'fixtures', 'search_results_fixture.json'
    )
    with open(fixture_path) as fixture_file:
        return json.load(fixture_file)


def _get_fixture_multiple_pages_data():
    test_root = os.path.abspath(
        os.path.join(os.path.dirname(__file__), "..")
    )
    fixture_path = os.path.join(
import mock
import unittest
import datetime
from werkzeug.exceptions import NotFound

import app.helpers as helpers
from dmcontent.content_loader import ContentLoader

from dmapiclient import api_stubs

content_loader = ContentLoader('tests/fixtures/content')
content_loader.load_manifest('dos', 'data', 'edit_brief')
questions_builder = content_loader.get_builder('dos', 'edit_brief')


class TestBuyersHelpers(unittest.TestCase):
    def test_get_framework_and_lot(self):
        data_api_client = mock.Mock()
        data_api_client.get_framework.return_value = api_stubs.framework(
            slug='digital-outcomes-and-specialists',
            status='live',
            lots=[
                api_stubs.lot(slug='digital-specialists', allows_brief=True)
            ]
        )

        framework, lot = helpers.buyers_helpers.get_framework_and_lot('digital-outcomes-and-specialists',
                                                                      'digital-specialists',
                                                                      data_api_client)

        assert framework['status'] == "live"