There was a problem creating unittest to make sure that the method I need works well. Running it with nodetests, although it did not give any coverage.
import unittest from mock import Mock, patch, MagicMock from django.conf import settings from hackathon.scripts.steam import * class SteamTests(unittest.TestCase): def setup(self): self.API_URL = 'http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/' self.APIKEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx' self.userID = 'Marorin' self.steamnum = '76561197997115778' def testGetUserIDNum(self): '''Test for steam.py method'''
Way of pulling information:
def steamIDPulling(SteamUN,key): #Pulls out and returns the steam id number for use in steam queries. steaminfo = {'key': key,'vanityurl': SteamUN} a = requests.get('api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/';, params=steaminfo) k = json.loads(a.content) SteamID = k['response']['steamid'] return SteamID
source share