vcr.use_cassette

Here are the examples of the python api vcr.use_cassette taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

182 Examples 7

Example 1

Project: vcrpy Source File: test_aiohttp.py
def test_params_same_url_distinct_params(tmpdir, scheme):
    url = scheme + '://httpbin.org/get'
    params = {'a': 1, 'b': False, 'c': 'c'}
    with vcr.use_cassette(str(tmpdir.join('get.yaml'))) as cassette:
        _, response_json = get(url, as_text=False, params=params)

    with vcr.use_cassette(str(tmpdir.join('get.yaml'))) as cassette:
        _, cassette_response_json = get(url, as_text=False, params=params)
        assert cassette_response_json == response_json
        assert cassette.play_count == 1

    other_params = {'other': 'params'}
    with vcr.use_cassette(str(tmpdir.join('get.yaml'))) as cassette:
        response, cassette_response_text = get(url, as_text=True, params=other_params)
        assert 'No match for the request' in cassette_response_text
        assert response.status == 599

Example 2

Project: vcrpy Source File: test_requests.py
def test_filter_post_params(tmpdir, httpbin_both):
    '''
    This tests the issue in https://github.com/kevin1024/vcrpy/issues/158

    Ensure that a post request made through requests can still be filtered.
    with vcr.use_cassette(cass_file, filter_post_data_parameters=['id']) as cass:
        assert b'id=secret' not in cass.requests[0].body
    '''
    url = httpbin_both.url + '/post'
    cass_loc = str(tmpdir.join('filter_post_params.yaml'))
    with vcr.use_cassette(cass_loc, filter_post_data_parameters=['key']) as cass:
        requests.post(url, data={'key': 'value'})
    with vcr.use_cassette(cass_loc, filter_post_data_parameters=['key']) as cass:
        assert b'key=value' not in cass.requests[0].body

Example 3

Project: python-dlipower Source File: test_dlipower.py
    @unittest.skip
    @vcr.use_cassette(cassette_library_dir='test/fixtures')
    def test_command_on_outlets(self):
        for i in range(0, 5):
            self.p[i].off()
        self.p.command_on_outlets('ON', range(1,6))
        for i in range(0, 5):
            self.assertEqual(self.p[i].state, 'ON')

Example 4

Project: gbdxtools Source File: test_catalog.py
    @vcr.use_cassette('tests/unit/cassettes/test_catalog_get_address_coords.yaml', filter_headers=['authorization'])
    def test_catalog_get_address_coords(self):
        c = Catalog(self.gbdx)
        lat, lng = c.get_address_coords('Boulder, CO')
        self.assertTrue(lat == 40.0149856)
        self.assertTrue(lng == -105.2705456)

Example 5

Project: py-gocd Source File: test_pipeline.py
@vcr.use_cassette('tests/fixtures/cassettes/api/pipeline/release-unsuccessful.yml')
def test_release_when_pipeline_is_unlocked(locked_pipeline):
    response = locked_pipeline.release()

    assert not response
    assert not response.is_ok
    assert response.content_type == 'text/html'
    assert response.payload.decode('utf-8') == (
        'lock exists within the pipeline configuration but no pipeline '
        'instance is currently in progress\n'
    )

Example 6

Project: gbdxtools Source File: test_idaho.py
    @vcr.use_cassette('tests/unit/cassettes/test_idaho_get_images_by_catid_and_aoi.yaml', filter_headers=['authorization'])
    def test_idaho_get_images_by_catid_and_aoi(self):
        i = Idaho(self.gbdx)
        catid = '10400100203F1300'
        aoi_wkt = "POLYGON ((-105.0207996368408345 39.7338828628182839, -105.0207996368408345 39.7365972921260067, -105.0158751010894775 39.7365972921260067, -105.0158751010894775 39.7338828628182839, -105.0207996368408345 39.7338828628182839))"
        results = i.get_images_by_catid_and_aoi(catid=catid, aoi_wkt=aoi_wkt)
        assert len(results['results']) == 2

Example 7

Project: pyvmomi Source File: test_managed_object.py
    @vcr.use_cassette('root_folder_parent.yaml',
                      cassette_library_dir=tests.fixtures_path,
                      record_mode='once')
    def test_root_folder_parent(self):
        # see: http://python3porting.com/noconv.html
        si = connect.SmartConnect(host='vcsa',
                                  user='my_user',
                                  pwd='my_password')

        root_folder = si.content.rootFolder
        self.assertTrue(hasattr(root_folder, 'parent'))
        # NOTE (hartsock): assertIsNone does not work in Python 2.6
        self.assertTrue(root_folder.parent is None)

Example 8

Project: py-gocd Source File: test_artifact.py
Function: test_get
@pytest.mark.parametrize('cassette_name,path_to_file, expected_content', [
    ('tests/fixtures/cassettes/api/artifact/get-output.yml', 'output.txt', '3239273'),
    ('tests/fixtures/cassettes/api/artifact/get-foo-a.yml', 'foo/a.txt', '5933126')
])
def test_get(artifact, cassette_name, path_to_file, expected_content):
    with vcr.use_cassette(cassette_name):
        response = artifact.get(path_to_file)

    assert response.status_code == 200
    assert response.fp.read().decode('utf-8') == expected_content

Example 9

Project: swiftype-py Source File: test_swiftype.py
    def test_crawl_url(self):
        with vcr.use_cassette('fixtures/crawl_domain.yaml'):
            domain_id = '52c754fb3ae7406fd3000001'
            url = 'http://crawler-demo-site.herokuapp.com/2012/01/01/first-post.html'
            crawled_url = self.client.crawl_url('crawler-demo', domain_id, url)['body']['url']
            self.assertEqual(crawled_url, url)

Example 10

Project: gbdxtools Source File: test_catalog.py
    @vcr.use_cassette('tests/unit/cassettes/test_catalog_get_record_with_relationships.yaml', filter_headers=['authorization'])
    def test_catalog_get_record_with_relationships(self):
        c = Catalog(self.gbdx)
        catid = '1040010019B4A600'
        record = c.get(catid, includeRelationships=True)

        self.assertEqual(record['identifier'], '1040010019B4A600')
        self.assertEqual(record['type'], 'DigitalGlobeAcquisition')

        self.assertTrue('inEdges' in list(record.keys()))

Example 11

Project: pyvmomi Source File: test_connect.py
    @vcr.use_cassette('basic_connection.yaml',
                      cassette_library_dir=tests.fixtures_path,
                      record_mode='none')
    def test_basic_connection(self):
        # see: http://python3porting.com/noconv.html
        si = connect.Connect(host='vcsa',
                             user='my_user',
                             pwd='my_password')
        cookie = si._stub.cookie
        session_id = si.content.sessionManager.currentSession.key
        # NOTE (hartsock): The cookie value should never change during
        # a connected session. That should be verifiable in these tests.
        self.assertEqual(cookie, si._stub.cookie)
        # NOTE (hartsock): assertIsNotNone does not work in Python 2.6
        self.assertTrue(session_id is not None)
        self.assertEqual('52b5395a-85c2-9902-7835-13a9b77e1fec', session_id)

Example 12

Project: gbdxtools Source File: test_catalog.py
    @vcr.use_cassette('tests/unit/cassettes/test_catalog_search_wkt_and_startDate.yaml',filter_headers=['authorization'])
    def test_catalog_search_wkt_and_startDate(self):
        c = Catalog(self.gbdx)
        results = c.search(searchAreaWkt="POLYGON ((30.1 9.9, 30.1 10.1, 29.9 10.1, 29.9 9.9, 30.1 9.9))",
                           startDate='2012-01-01T00:00:00.000Z')
        assert len(results) == 317

Example 13

Project: gbdxtools Source File: test_catalog.py
    @vcr.use_cassette('tests/unit/cassettes/test_catalog_search_types1.yaml',filter_headers=['authorization'])
    def test_catalog_search_types1(self):
        c = Catalog(self.gbdx)

        types = [ "LandsatAcquisition" ]

        results = c.search(types=types,
                           searchAreaWkt="POLYGON ((30.1 9.9, 30.1 10.1, 29.9 10.1, 29.9 9.9, 30.1 9.9))")

        for result in results:
            assert result['type'] == 'LandsatAcquisition'

Example 14

Project: pyvmomi Source File: test_connect.py
    @vcr.use_cassette('ssl_tunnel_http_failure.yaml',
                      cassette_library_dir=tests.fixtures_path,
                      record_mode='none')
    def test_ssl_tunnel_http_failure(self):
        from six.moves import http_client
        def should_fail():
            connect.SoapStubAdapter('vcsa', 80, httpProxyHost='vcsa').GetConnection()
        self.assertRaises(http_client.HTTPException, should_fail)

Example 15

Project: duecredit Source File: test_io.py
    @vcr.use_cassette()
    def test_import_doi():
        doi_good = '10.1038/nrd842'
        kw = dict(sleep=0.00001, retries=2)
        assert_is_instance(import_doi(doi_good, **kw), text_type)

        doi_bad = 'fasljfdldaksj'
        assert_raises(ValueError, import_doi, doi_bad, **kw)

        doi_zenodo = '10.5281/zenodo.50186'
        assert_is_instance(import_doi(doi_zenodo, **kw), text_type)

Example 16

Project: swiftype-py Source File: test_swiftype.py
    def test_search_with_options(self):
        with vcr.use_cassette('fixtures/search_with_options.yaml'):
            total_count = len(self.client.docuement_types(self.engine)['body'])
            self.assertTrue(total_count > 1)
            response = self.client.search(self.engine, 'query', {'page': 2})
            self.assertEqual(len(response['body']['records']), total_count)

Example 17

Project: anitya Source File: __init__.py
    def setUp(self):
        """ Set up the environnment, ran before every tests. """
        if ':///' in DB_PATH:
            dbfile = DB_PATH.split(':///')[1]
            if os.path.exists(dbfile):
                os.unlink(dbfile)
        self.session = anitya.lib.init(DB_PATH, create=True, debug=False)
        anitya.LOG.handlers = []
        anitya.LOG.setLevel(logging.CRITICAL)

        anitya.lib.plugins.load_plugins(self.session)
        self.vcr = vcr.use_cassette('tests/request-data/' + self.id())
        self.vcr.__enter__()

Example 18

Project: scrapi Source File: test_helpers.py
    @vcr.use_cassette('tests/vcr/asu.yaml')
    def test_oai_get_records_and_token(self):
        url = 'http://repository.asu.edu/oai-pmh?verb=ListRecords&metadataPrefix=oai_dc&from=2015-03-10&until=2015-03-11'
        force = False
        verify = True
        throttle = 0.5
        namespaces = {
            'dc': 'http://purl.org/dc/elements/1.1/',
            'ns0': 'http://www.openarchives.org/OAI/2.0/',
            'oai_dc': 'http://www.openarchives.org/OAI/2.0/',
        }
        records, token = helpers.oai_get_records_and_token(url, throttle, force, namespaces, verify)
        assert records
        assert token
        assert len(records) == 50

Example 19

Project: py-gocd Source File: test_pipeline.py
Function: test_history
@pytest.mark.parametrize('cassette_name,offset,counter', [
    ('tests/fixtures/cassettes/api/pipeline/history-offset-0.yml', 0, 11),
    ('tests/fixtures/cassettes/api/pipeline/history-offset-10.yml', 10, 1)
])
def test_history(pipeline, cassette_name, offset, counter):
    with vcr.use_cassette(cassette_name):
        response = pipeline.history(offset=offset)

    assert response.is_ok
    assert response.content_type == 'application/json'
    assert 'pipelines' in response
    run = response['pipelines'][0]
    assert run['name'] == 'Simple'
    assert run['counter'] == counter

Example 20

Project: flowy Source File: test_swf_integration.py
def test_workflow_integration():
    with vcr.use_cassette(W_CASSETTE,
                          record_mode='none', **cassette_args) as cass:
        try:
            cl = SWFClient(kwargs={'aws_access_key_id': 'x',
                                   'aws_secret_access_key': 'x',
                                   'region_name': 'us-east-1'})
            wworker.run_forever(DOMAIN, TASKLIST,
                                identity=IDENTITY,
                                swf_client=cl,
                                setup_log=False)
        except vcr.errors.CannotOverwriteExistingCassetteException:
            pass
        assert cass.all_played

Example 21

Project: py-gocd Source File: test_pipeline.py
Function: test_pause
@vcr.use_cassette('tests/fixtures/cassettes/api/pipeline/pause-successful.yml')
def test_pause(pipeline):
    response = pipeline.pause('Time to sleep')

    assert response.is_ok
    assert response.content_type == 'text/html'
    assert response.payload.decode('utf-8') == ' '

Example 22

Project: steam Source File: test_webauth.py
    @vcr.use_cassette('vcr/webauth_user_pass_only_success.yaml', mode='none', serializer='yaml')
    def test_login_user_and_pass_only_ok(self):
        user = wa.WebAuth('testuser', 'testpass')
        s = user.login()

        self.assertTrue(user.complete)
        self.assertIsInstance(s, requests.Session)

        for domain in s.cookies.list_domains():
            self.assertEqual(s.cookies.get('steamLogin', domain=domain), '0%7C%7C{}'.format('A'*16))
            self.assertEqual(s.cookies.get('steamLoginSecure', domain=domain), '0%7C%7C{}'.format('B'*16))
            self.assertEqual(s.cookies.get('steamMachineAuth0', domain=domain), 'C'*16)

        self.assertEqual(s, user.login())

Example 23

Project: gbdxtools Source File: test_catalog.py
    @vcr.use_cassette('tests/unit/cassettes/test_catalog_search_point.yaml', filter_headers=['authorization'])
    def test_catalog_search_point(self):
        c = Catalog(self.gbdx)
        lat = 40.0149856
        lng = -105.2705456
        results = c.search_point(lat, lng)

        self.assertEqual(len(results),310)

Example 24

Project: flowy Source File: test_swf_integration.py
def start_activity_worker():
    with vcr.use_cassette(A_CASSETTE,
                          record_mode='all', **cassette_args) as cass:
        try:
            aworker.run_forever(DOMAIN, TASKLIST, identity=IDENTITY)
        except vcr.errors.CannotOverwriteExistingCassetteException:
            pass

Example 25

Project: gbdxtools Source File: test_catalog.py
    @vcr.use_cassette('tests/unit/cassettes/test_catalog_search_wkt_and_endDate.yaml',filter_headers=['authorization'])
    def test_catalog_search_wkt_and_endDate(self):
        c = Catalog(self.gbdx)
        results = c.search(searchAreaWkt="POLYGON ((30.1 9.9, 30.1 10.1, 29.9 10.1, 29.9 9.9, 30.1 9.9))",
                           endDate='2012-01-01T00:00:00.000Z')
        assert len(results) == 78

Example 26

Project: pyvmomi Source File: test_connect.py
    @vcr.use_cassette('sspi_connection.yaml',
                      cassette_library_dir=tests.fixtures_path,
                      record_mode='none')
    def test_sspi_connection(self):
        # see: http://python3porting.com/noconv.html
        si = connect.Connect(host='vcsa',
                             mechanism='sspi',
                             b64token='my_base64token')
        cookie = si._stub.cookie
        session_id = si.content.sessionManager.currentSession.key
        # NOTE (hartsock): The cookie value should never change during
        # a connected session. That should be verifiable in these tests.
        self.assertEqual(cookie, si._stub.cookie)
        # NOTE (hartsock): assertIsNotNone does not work in Python 2.6
        self.assertTrue(session_id is not None)
        self.assertEqual('52b5395a-85c2-9902-7835-13a9b77e1fec', session_id)

Example 27

Project: gbdxtools Source File: test_catalog.py
    @vcr.use_cassette('tests/unit/cassettes/test_catalog_search_startDate_and_endDate_only_more_than_one_week_apart.yaml',filter_headers=['authorization'])
    def test_catalog_search_startDate_and_endDate_only_more_than_one_week_apart(self):
        c = Catalog(self.gbdx)

        try:
            results = c.search(startDate='2004-01-01T00:00:00.000Z',
                               endDate='2012-01-01T00:00:00.000Z')
        except Exception as e:
            pass
        else:
            raise Exception('failed test')

Example 28

Project: gbdxtools Source File: test_catalog.py
    @vcr.use_cassette('tests/unit/cassettes/test_catalog_search_filters2.yaml',filter_headers=['authorization'])
    def test_catalog_search_filters2(self):
        c = Catalog(self.gbdx)

        filters = [  
                    "sensorPlatformName = 'WORLDVIEW03'"
                  ]

        results = c.search(filters=filters,
                           searchAreaWkt="POLYGON ((30.1 9.9, 30.1 10.1, 29.9 10.1, 29.9 9.9, 30.1 9.9))")

        for result in results:
            assert result['properties']['sensorPlatformName'] in ['WORLDVIEW03']

Example 29

Project: pyvmomi Source File: test_connect.py
    @vcr.use_cassette('smart_connection.yaml',
                      cassette_library_dir=tests.fixtures_path,
                      record_mode='none')
    def test_smart_connection(self):
        # see: http://python3porting.com/noconv.html
        si = connect.SmartConnect(host='vcsa',
                                  user='my_user',
                                  pwd='my_password')
        session_id = si.content.sessionManager.currentSession.key
        # NOTE (hartsock): assertIsNotNone does not work in Python 2.6
        self.assertTrue(session_id is not None)
        self.assertEqual('52ad453a-13a7-e8af-9186-a1b5c5ab85b7', session_id)

Example 30

Project: gbdxtools Source File: test_catalog.py
    @vcr.use_cassette('tests/unit/cassettes/test_catalog_search_huge_aoi.yaml',filter_headers=['authorization'])
    def test_catalog_search_huge_aoi(self):
        """
        Search an AOI the size of utah, broken into multiple smaller searches
        """
        c = Catalog(self.gbdx)

        results = c.search(searchAreaWkt = "POLYGON((-113.88427734375 40.36642741921034,-110.28076171875 40.36642741921034,-110.28076171875 37.565262680889965,-113.88427734375 37.565262680889965,-113.88427734375 40.36642741921034))")
        
        assert len(results) == 2736

Example 31

Project: swiftype-py Source File: test_swiftype.py
    def test_update_docuements(self):
        with vcr.use_cassette('fixtures/update_docuements.yaml'):
            docuements = [ {'external_id': '1', 'fields': { 'myfieldthathasnotbeencreated': 'foobar' }},
                          {'external_id': '2', 'fields': { 'title': 'new title' }} ]
            stati = self.client.update_docuements(self.engine, self.docuement_type, docuements)['body']
            self.assertEqual(stati, [False, True])

Example 32

Project: gbdxtools Source File: test_idaho.py
    @vcr.use_cassette('tests/unit/cassettes/test_idaho_get_images_by_catid.yaml', filter_headers=['authorization'])
    def test_idaho_get_images_by_catid(self):
        i = Idaho(self.gbdx)
        catid = '10400100203F1300'
        results = i.get_images_by_catid(catid=catid)
        assert len(results['results']) == 12

Example 33

Project: pyvmomi Source File: test_iso8601.py
    @vcr.use_cassette('test_vm_config_iso8601.yaml',
                      cassette_library_dir=tests.fixtures_path,
                      record_mode='once')
    def test_vm_config_iso8601(self):
        si = connect.SmartConnect(host='vcsa',
                                  user='my_user',
                                  pwd='my_password')

        search_index = si.content.searchIndex
        uuid = "5001ad1b-c78d-179e-ecd7-1cc0e1cf1b96"
        vm = search_index.FindByUuid(None, uuid, True, True)
        boot_time = vm.runtime.bootTime
        # NOTE (hartsock): assertIsNone does not work in Python 2.6
        self.assertTrue(boot_time is not None)

        # 2014-08-05T17:50:20.594958Z
        expected_time = datetime(2014, 8, 5, 17, 50, 20, 594958,
                                 boot_time.tzinfo)
        self.assertEqual(expected_time, boot_time)

Example 34

Project: python-dlipower Source File: test_dlipower.py
    @vcr.use_cassette(cassette_library_dir='test/fixtures')
    def test_powerswitch_repr_html(self):
        self.assertIn(
            '<tr><th colspan="3">DLI Web Powerswitch at lpc.digital-loggers.com</th></tr>',
            self.p._repr_html_()
        )

Example 35

Project: flowy Source File: test_swf_integration.py
def test_activity_integration():
    with vcr.use_cassette(A_CASSETTE,
                          record_mode='none', **cassette_args) as cass:
        try:
            cl = SWFClient(kwargs={'aws_access_key_id': 'x',
                                   'aws_secret_access_key': 'x',
                                   'region_name': 'us-east-1'})
            aworker.run_forever(DOMAIN, TASKLIST,
                                identity=IDENTITY,
                                swf_client=cl,
                                setup_log=False)
        except vcr.errors.CannotOverwriteExistingCassetteException:
            pass
        assert cass.all_played

Example 36

Project: pygrabbit Source File: test_pygrabbit.py
@pytest.fixture
def grab():
    @vcr.use_cassette('fixtures/vcr_cassettes/pygrabbit.yaml',
                      record_mode='new_episodes')
    def make_grabbit(url):
        return PyGrabbit.url(url)
    return make_grabbit

Example 37

Project: scrapi Source File: test_harvesters.py
@pytest.mark.parametrize('harvester_name', filter(lambda x: x != 'test', sorted(map(str, registry.keys()))))
def test_harvester(monkeypatch, harvester_name, *args, **kwargs):
    monkeypatch.setattr(requests.time, 'sleep', lambda *_, **__: None)
    base.settings.RAISE_IN_TRANSFORMER = True

    harvester = registry[harvester_name]

    with vcr.use_cassette('tests/vcr/{}.yaml'.format(harvester_name), match_on=['host'], record_mode='none'):
        harvested = harvester.harvest()
        assert len(harvested) > 0

    normalized = list(filter(lambda x: x is not None, map(harvester.normalize, harvested[:25])))
    assert len(normalized) > 0

Example 38

Project: py-gocd Source File: test_artifact.py
Function: test_release
@vcr.use_cassette('tests/fixtures/cassettes/api/artifact/list.yml')
def test_release(artifact):
    response = artifact.list()

    assert response.is_ok
    assert response.content_type == 'application/json'
    assert len(response.payload) == 3
    assert set(x['name'] for x in response) == set(['cruise-output', 'foo', 'output.txt'])
    foo = next(x for x in response if x['name'] == 'foo')
    assert len(foo['files']) == 2

Example 39

Project: swiftype-py Source File: test_swiftype.py
    def test_suggest_with_options(self):
        with vcr.use_cassette('fixtures/suggest_with_options.yaml'):
            total_count = len(self.client.docuement_types(self.engine)['body'])
            self.assertTrue(total_count > 1)
            response = self.client.suggest(self.engine, 'query', {'page': 2})
            self.assertEqual(len(response['body']['records']), total_count)

Example 40

Project: py-gocd Source File: test_artifact.py
Function: test_get_directory
@vcr.use_cassette('tests/fixtures/cassettes/api/artifact/get_directory.yml')
def test_get_directory(artifact):
    response = artifact.get_directory('foo', backoff=0.1)

    assert response.status_code == 200

    file_like_object = io.BytesIO(response.fp.read())
    zip_file = zipfile.ZipFile(file_like_object)
    assert set(['foo/', 'foo/a.txt', 'foo/b.txt']) == set(zip_file.namelist())

Example 41

Project: votainteligente-portal-electoral Source File: facebook_page_getter_tests.py
    @vcr.use_cassette(__dir__ + '/fixtures/vcr_cassettes/circoroto.yaml')
    def test_get_things_from_facebook(self):
        result = facebook_getter('https://www.facebook.com/circoroto?fref=ts')
        self.assertEquals(result['about'], u'Agrupación de circo del barrio Yungay')
        self.assertTrue(result['picture_url'])
        self.assertTrue(result['events'])

Example 42

Project: py-gocd Source File: test_pipeline.py
Function: test_release
@vcr.use_cassette('tests/fixtures/cassettes/api/pipeline/release-successful.yml')
def test_release(locked_pipeline):
    response = locked_pipeline.release()

    assert response.is_ok
    assert response.content_type == 'text/html'
    assert response.payload.decode('utf-8') == 'pipeline lock released for {0}\n'.format(
        locked_pipeline.name
    )

Example 43

Project: sdbot Source File: test_github.py
Function: test_basic
def test_basic():
    with vcr.use_cassette('test/fixtures/github_issues.yaml'):
        ret = on_message({"text": u"!hub issue 5 -r llimllib/limbo", "channel": "test_channel"}, SERVER)
        #import ipdb; ipdb.set_trace()
        expected = {
            u'author_icon': u'https://avatars.githubusercontent.com/u/7150?v=3',
            u'author_link': u'https://github.com/llimllib',
            u'author_name': u'llimllib',
            u'color': u'good',
            u'fallback': u'Create an emoji translator',
            u'text': u'i.e. if you type "I love to eat bananas", the plugin does *something* to try and convert that into a string of emoji. It probably involves a list of synonyms? Maybe even a word model? Or it does something really simple? I don\'t know, but it would be an awesome feature.',
            u'title': u'[5] Create an emoji translator',
            u'title_link': u'https://github.com/llimllib/limbo/issues/5'
        }
        actual = json.loads(SERVER.slack.posted_message[1]['attachments'])
        eq_(len(actual), 1)
        dicteq(expected, actual[0])

Example 44

Project: gbdxtools Source File: test_catalog.py
    @vcr.use_cassette('tests/unit/cassettes/test_catalog_get_record.yaml', filter_headers=['authorization'])
    def test_catalog_get_record(self):
        c = Catalog(self.gbdx)
        catid = '1040010019B4A600'
        record = c.get(catid)

        self.assertEqual(record['identifier'], '1040010019B4A600')
        self.assertEqual(record['type'], 'DigitalGlobeAcquisition')

        self.assertTrue('inEdges' not in list(record.keys()))

Example 45

Project: gbdxtools Source File: test_catalog.py
    @vcr.use_cassette('tests/unit/cassettes/test_catalog_search_startDate_and_endDate_only_less_than_one_week_apart.yaml',filter_headers=['authorization'])
    def test_catalog_search_startDate_and_endDate_only_less_than_one_week_apart(self):
        c = Catalog(self.gbdx)

        results = c.search(startDate='2008-01-01T00:00:00.000Z',
                               endDate='2008-01-03T00:00:00.000Z')

        assert len(results) == 759

Example 46

Project: pyembed Source File: integration_test.py
@vcr.use_cassette('pyembed/core/test/fixtures/cassettes/custom_renderer.yml')
def test_should_embed_with_custom_renderer():
    embedding = PyEmbed(renderer=DummyRenderer()).embed(
        'http://www.youtube.com/watch?v=qrO4YZeyl0I')
    assert embedding == \
        'Lady Gaga - Bad Romance by LadyGagaVEVO from ' + \
        'http://www.youtube.com/watch?v=qrO4YZeyl0I'

Example 47

Project: sdbot Source File: test_stock.py
Function: test_apple
def test_apple():
    with vcr.use_cassette('test/fixtures/stock_apple.yaml'):
        ret = on_message({"text": u"$aapl"}, None)
        assert ':chart_with_upwards_trend:' in ret
        assert 'Apple Inc.' in ret
        assert '130.41' in ret
        assert '+1.62' in ret

Example 48

Project: flowy Source File: test_swf_integration.py
def start_workflow_worker():
    with vcr.use_cassette(W_CASSETTE,
                          record_mode='all', **cassette_args) as cass:
        try:
            wworker.run_forever(DOMAIN, TASKLIST, identity=IDENTITY)
        except vcr.errors.CannotOverwriteExistingCassetteException:
            pass

Example 49

Project: pyvmomi Source File: test_connect.py
    @vcr.use_cassette('basic_connection_bad_password.yaml',
                      cassette_library_dir=tests.fixtures_path,
                      record_mode='none')
    def test_basic_connection_bad_password(self):
        def should_fail():
            connect.Connect(host='vcsa',
                            user='my_user',
                            pwd='bad_password')

        self.assertRaises(vim.fault.InvalidLogin, should_fail)

Example 50

Project: gbdxtools Source File: test_catalog.py
    @vcr.use_cassette('tests/unit/cassettes/test_catalog_search_filters1.yaml',filter_headers=['authorization'])
    def test_catalog_search_filters1(self):
        c = Catalog(self.gbdx)

        filters = [  
                        "(sensorPlatformName = 'WORLDVIEW01' OR sensorPlatformName ='QUICKBIRD02')",
                        "cloudCover < 10",
                        "offNadirAngle < 10"
                    ]

        results = c.search(startDate='2008-01-01T00:00:00.000Z',
                           endDate='2012-01-03T00:00:00.000Z',
                           filters=filters,
                           searchAreaWkt="POLYGON ((30.1 9.9, 30.1 10.1, 29.9 10.1, 29.9 9.9, 30.1 9.9))")

        for result in results:
            assert result['properties']['sensorPlatformName'] in ['WORLDVIEW01','QUICKBIRD02']
            assert float(result['properties']['cloudCover']) < 10
            assert float(result['properties']['offNadirAngle']) < 10
See More Examples - Go to Next Page
Page 1 Selected Page 2 Page 3 Page 4