コード例 #1
0
    def test_get_api_data(self):
        """Test if data is retrived correctly"""

        test_site = "http://www.usa.gov/api/USAGovAPI/contacts.json"
        test_site += "/contact/48005"
        test_cache = "tests/fixtures/cassettes/test_cache"
        data = usa_layer.get_api_data(url=test_site, cache=test_cache)
        self.assertTrue("Census" in data.keys())
コード例 #2
0
    def test_get_api_data(self):
        """Test if data is retrived correctly"""

        test_site = "http://www.usa.gov/api/USAGovAPI/contacts.json"
        test_site += "/contact/48005"
        test_cache = "tests/fixtures/cassettes/test_cache"
        data = usa_layer.get_api_data(url=test_site, cache=test_cache)
        self.assertTrue("Census" in data.keys())
コード例 #3
0
    def test_patch_yamls(self):
        """ Test if yaml files are correctly updated """

        test_site = "http://www.usa.gov/api/USAGovAPI/contacts.json"
        test_site += "/contact/48005"
        test_cache = "tests/fixtures/cassettes/test_cache"
        data = usa_layer.get_api_data(url=test_site, cache=test_cache)
        data.update({'Commerce': {'usa_id': '1111'}})

        patcher = usa_layer.patch_yamls(
            data=data, directory="tests/fixtures/cassettes/test_yaml.yaml")
        for patched_yaml in patcher:
            self.assertTrue('usa_id' in patched_yaml[0])
            self.assertTrue('usa_id' in patched_yaml[0].get('departments')[0])
            self.assertTrue(
                'description' in patched_yaml[0].get('departments')[0])
コード例 #4
0
    def test_patch_yamls(self):
        """ Test if yaml files are correctly updated """

        test_site = "http://www.usa.gov/api/USAGovAPI/contacts.json"
        test_site += "/contact/48005"
        test_cache = "tests/fixtures/cassettes/test_cache"
        data = usa_layer.get_api_data(url=test_site, cache=test_cache)
        data.update({'Commerce': {'usa_id': '1111'}})

        patcher = usa_layer.patch_yamls(
            data=data, directory="tests/fixtures/cassettes/test_yaml.yaml")
        for patched_yaml in patcher:
            self.assertTrue(
                'usa_id' in patched_yaml[0])
            self.assertTrue(
                'usa_id' in patched_yaml[0].get('departments')[0])
            self.assertTrue(
                'description' in patched_yaml[0].get('departments')[0])