Пример #1
0
    def test_auth_login(self):
        with mock.patch("descarteslabs.client.auth.cli.input", return_value=self.token):
            handle(parser.parse_args(["auth", "login"]))

        with mock.patch("sys.stdout", new_callable=StringIO) as out:
            handle(parser.parse_args(["auth", "groups"]))
            assert out.getvalue().strip() == '["public"]'
Пример #2
0
 def test_metadata_sources(self):
     with mock.patch("sys.stdout", new_callable=StringIO) as out:
         handle(parser.parse_args(["metadata", "sources"]))
         sources = [{
             "sat_id": "LANDSAT_8",
             "product": "landsat:LC08:PRE:TOAR"
         }]
         self.assertEqual(json.loads(out.getvalue().strip()), sources)
Пример #3
0
 def test_metadata_sources(self):
     with mock.patch('sys.stdout', new_callable=StringIO) as out:
         handle(parser.parse_args(["metadata", "sources"]))
         sources = [{
             'sat_id': 'LANDSAT_8',
             'product': 'landsat:LC08:PRE:TOAR'
         }]
         self.assertEqual(json.loads(out.getvalue().strip()), sources)
 def test_places_find(self):
     with mock.patch("sys.stdout", new_callable=StringIO) as out:
         handle(parser.parse_args(["places", "find", "iowa"]))
         iowa = [{
             "name": "Iowa",
             "bbox": [-96.639468, 40.37544, -90.140061, 43.501128],
             "id": 85688713,
             "path":
             "continent:north-america_country:united-states_region:iowa",
             "slug": "north-america_united-states_iowa",
             "placetype": "region",
         }]
         assert json.loads(out.getvalue().strip()) == iowa
Пример #5
0
def main():
    handle(parser.parse_args())