def test_ParseStockData(self): FakeDateTime.now = classmethod(lambda cls: DateTime.datetime(2010, 1, 1)) dbCrud.deleteData = mock.create_autospec(APIStockParser.dbCon.deleteData, return_value=True) dbCrud.InsertData = mock.create_autospec(APIStockParser.dbCon.InsertData, return_value=True) symbol = "Goog" user = "******" days = "10" jwt = jsonWebToken.encode({'user':user, 'symbol':symbol, 'daysToGet':days}) expected = 'Operation complete, now sit back and wait for the money to roll in!!' self.assertEquals(APIStockParser.ParseStockData(jwt), expected)
def issueJwt(username, symbol, days): return jsonWebToken.encode({'user':username, 'symbol':symbol, 'daysToGet': days})
def test_encode(self): expected = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmYWtlIjoicGF5bG9hZCJ9.aIMnxkP099xPuOMQhCnMUttdZN1bjENLFMlTevuVgh4' payload = {'fake':'payload'} self.assertEqual(jsonWebToken.encode(payload), expected)