예제 #1
0
 def test_rsa_fail(self):
     httpretty.register_uri(httpretty.POST, 'https://steamcommunity.com/mobilelogin/getrsakey/',
                             body='{"success": false}',
                             content_type='application/json; charset=utf-8')
     swb = SteamWebBrowser('user', 'password')
     with self.assertRaises(SteamWebError):
         swb._get_rsa_key()
예제 #2
0
 def test_rsa_fail(self):
     httpretty.register_uri(
         httpretty.POST,
         'https://steamcommunity.com/mobilelogin/getrsakey/',
         body='{"success": false}',
         content_type='application/json; charset=utf-8')
     swb = SteamWebBrowser('user', 'password')
     with self.assertRaises(SteamWebError):
         swb._get_rsa_key()
예제 #3
0
    def test_appdata_path(self):
        ''' Test if appdata path is created '''
        appdata_paths = ('STEAMWEBROWSER_HOME', 'APPDATA', 'XDG_CONFIG_HOME',
                         'HOME')
        for key in appdata_paths:
            temp_dir = tempfile.mkdtemp()
            with mock.patch.dict('os.environ', {key: temp_dir}):
                # Remove all other keys from environ
                for a in appdata_paths:
                    if a != key and a in os.environ:
                        del os.environ[a]

                swb = SteamWebBrowser('user', 'password')
                self.assertTrue(os.path.isdir(swb.appdata_path))
                self.assertTrue(os.access(swb.appdata_path, os.W_OK))
예제 #4
0
 def test_not_logged_in(self):
     httpretty.register_uri(httpretty.HEAD, 'https://store.steampowered.com/login/',
                             status=200)
     swb = SteamWebBrowser('user', 'password')
     self.assertFalse(swb.logged_in())
예제 #5
0
 def test_not_logged_in(self):
     httpretty.register_uri(httpretty.HEAD,
                            'https://store.steampowered.com/login/',
                            status=200)
     swb = SteamWebBrowser('user', 'password')
     self.assertFalse(swb.logged_in())