Example #1
0
    def test_with_tocken(self):
        auth = Auth(token=generate_token())

        # If the request is sent successfully, then I expect a response to
        # be returned.
        self.assertIsInstance(auth.__str__(), str)
        self.assertFalse(auth.is_expired())
Example #2
0
    def test_login(self):
        # Call the service, which will send a request to the server.
        auth = Auth(user='******', password='******')

        # If the request is sent successfully, then I expect a response to
        # be returned.
        self.assertIsInstance(auth.__str__(), str)
        self.assertFalse(auth.is_expired())
Example #3
0
    def test_expired(self):
        self.mock_get.return_value = Mock()
        self.mock_get.return_value.text = generate_token(
            now=self.now-10000)
        self.mock_get.return_value.status_code = 200

        # Call the service, which will send a request to the server.
        auth = Auth(user='******', password='******')

        self.assertIsInstance(auth.__str__(), str)
        self.assertTrue(auth.is_expired())