Exemplo n.º 1
0
 def test_prettify(self):
     self.assertEqual(
         connections.RemoteAuth('company', 'username',
                                'p@ssw0rd').prettify(),
         (b'<?xml version="1.0" encoding="utf-8"?>\n'
          b'<RemoteAuth>\n'
          b'  <Login>\n'
          b'    <company>company</company>\n'
          b'    <user>username</user>\n'
          b'    <password>p@ssw0rd</password>\n'
          b'  </Login>\n'
          b'</RemoteAuth>\n'))
Exemplo n.º 2
0
 def test_tostring_remoteauth(self):
     app = connections.Application('test', '1.0', 'default', 'abc123')
     remoteauth = connections.RemoteAuth('company', 'username', 'p@ssw0rd')
     time = [commands.Time().time()]
     self.assertEqual(
         connections.Request(app, remoteauth, time).tostring(),
         (
             b'<?xml version="1.0" encoding="utf-8"?>'
             b'<request API_ver="1.0" client="test" client_ver="1.0" '
             b'key="abc123" namespace="default"><RemoteAuth><Login>'
             b'<company>company</company><user>username</user>'
             b'<password>p@ssw0rd</password></Login></RemoteAuth>'
             b'<Time /></request>'
         )
     )
Exemplo n.º 3
0
 def test_tostring(self):
     self.assertEqual(
         connections.RemoteAuth('company', 'username',
                                'p@ssw0rd').tostring(),
         (b'<RemoteAuth><Login><company>company</company><user>username</user>'
          b'<password>p@ssw0rd</password></Login></RemoteAuth>'))
Exemplo n.º 4
0
 def test_auth(self):
     self.assertIsInstance(
         connections.RemoteAuth('company', 'username',
                                'p@ssw0rd').remoteauth(), ET.Element)
Exemplo n.º 5
0
 def test_str(self):
     self.assertEqual(
         str(connections.RemoteAuth('company', 'username', 'p@ssw0rd')),
         '<RemoteAuth company=company username=username>')