コード例 #1
0
 def test_launch_json(self):
     resp_json = launchlibrary.launch().json()
     self.assertIsInstance(resp_json, dict)
     self.assertIn('launches', resp_json)
     self.assertIsInstance(resp_json['launches'], list)
     self.assertIn('total', resp_json)
     self.assertIsInstance(resp_json['total'], int)
     self.assertIn('count', resp_json)
     self.assertIsInstance(resp_json['count'], int)
     self.assertIn('offset', resp_json)
     self.assertIsInstance(resp_json['offset'], int)
コード例 #2
0
 def test_launch_mode_summary(self):
     resp_json = launchlibrary.launch(mode='summary').json()
     launches = resp_json['launches']
     launch = launches[0]
     keys = [
         'id', 'name', 'windowstart', 'windowend', 'net', 'status',
         'inhold', 'tbdtime', 'tbddate', 'probability', 'changed', 'lsp',
         'hashtag', 'vidURL', 'vidURLs'
     ]
     keys = sorted(keys)
     resp_keys = sorted(launch.keys())
     self.assertListEqual(resp_keys, keys)
コード例 #3
0
 def test_launch_mode_verbose(self):
     resp_json = launchlibrary.launch(mode='verbose').json()
     launches = resp_json['launches']
     launch = launches[0]
     keys = [
         'id', 'name', 'windowstart', 'windowend', 'net', 'wsstamp',
         'westamp', 'netstamp', 'isostart', 'isoend', 'isonet', 'status',
         'inhold', 'tbdtime', 'vidURLs', 'vidURL', 'infoURLs', 'infoURL',
         'holdreason', 'failreason', 'tbddate', 'probability', 'hashtag',
         'changed', 'location', 'rocket', 'missions', 'lsp'
     ]
     keys = sorted(keys)
     resp_keys = sorted(launch.keys())
     self.assertListEqual(resp_keys, keys)
コード例 #4
0
 def test_launch_sort(self):
     # default order is ascending, so we will only check that
     # descending (sort='desc') works
     #
     # upon further inspection, sort doesn't seem to work in the
     # website's API, so this really does nothing until they fix that
     resp_json = launchlibrary.launch(sort='desc').json()
     launches = resp_json['launches']
     launch0 = launches[0]
     launch1 = launches[1]
     date_format = '%B %d, %Y %H:%M:%S'  # format of NET without the UTC
     net0 = launch0['net'][:-4]  # strip off the 'UTC' at the end
     net1 = launch1['net'][:-4]  # strip off the 'UTC' at the end
     dt0 = datetime.strptime(net0, date_format)
     dt1 = datetime.strptime(net1, date_format)
     self.assertLess(dt0, dt1)
コード例 #5
0
 def test_launch(self):
     resp = launchlibrary.launch()
     self.assertEqual(200, resp.status_code)
     self.assertIsInstance(resp, Response)