Skip to content

Instantly share code, notes, and snippets.

@ddahan
Created January 4, 2017 16:31
Show Gist options
  • Save ddahan/5e22ed152e69767e3ec6416a2828774c to your computer and use it in GitHub Desktop.
Save ddahan/5e22ed152e69767e3ec6416a2828774c to your computer and use it in GitHub Desktop.
class GetClientFromCard_1_Test(LiveServerTestCase):
''' Test du WS GetClientFromCard_1 '''
def setUp(self):
api_test_scenario()
self.url = BASE_T_URL + 'get_client_from_card/'
def test_scan_invalid_card(self):
''' Scan d'un numéro de carte inconnu '''
resp = requests.get(self.url + '999', auth=OWNER_AUTH)
self.assertEqual(resp.status_code, 404)
def test_scan_weird_stuff(self):
''' Scan d'un string étrange (ex : autre qr code) '''
resp = requests.get(self.url + '&$?_&!', auth=OWNER_AUTH)
self.assertEqual(resp.status_code, 404)
def test_scan_unlinked_card(self):
''' Scan d'une carte vierge, pas liée à un shop group '''
resp = requests.get(self.url + '30303030303', auth=OWNER_AUTH)
self.assertEqual(resp.json()['client_id'], None)
self.assertEqual(resp.status_code, 200)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment