Example #1
0
 def test_ltioauthdatastore(self):
     """
     Tests that LTIOAuthDataStore works
     """
     consumers = {
         "key1": {
             "secret": "secret1"
         },
         "key2": {
             "secret": "secret2"
         },
         "key3": {
             "secret": "secret3"
         },
         "keyNS": {
             "test": "test"
         },
         "keyWCert": {
             "secret": "secret",
             "cert": "cert"
         },
     }
     store = LTIOAuthDataStore(consumers)
     self.assertEqual(store.lookup_consumer("key1").secret, "secret1")
     self.assertEqual(store.lookup_consumer("key2").secret, "secret2")
     self.assertEqual(store.lookup_consumer("key3").secret, "secret3")
     self.assertEqual(store.lookup_cert("keyWCert"), "cert")
     self.assertIsNone(store.lookup_consumer("key4"))
     self.assertIsNone(store.lookup_cert("key4"))
     self.assertIsNone(store.lookup_consumer("keyNS"))
     self.assertIsNone(store.lookup_cert("keyNS"))
Example #2
0
    def test_lti_oauth_data_store_no_consumers(self):
        """
        If consumers are not given it there are no consumer to return.
        """

        store = LTIOAuthDataStore(None)
        self.assertIsNone(store.lookup_consumer("key1"))
        self.assertIsNone(store.lookup_cert("key1"))
Example #3
0
    def test_ltioauthdatastore_no_consumers(self):
        """
        If consumers are not given it there are no consumer to return.

        """
        store = LTIOAuthDataStore(None)
        self.assertIsNone(store.lookup_consumer("key1"))
        self.assertIsNone(store.lookup_cert("key1"))
Example #4
0
 def test_lti_oauth_data_store(self):
     """
     Tests that LTIOAuthDataStore works
     """
     consumers = {
         "key1": {"secret": "secret1"},
         "key2": {"secret": "secret2"},
         "key3": {"secret": "secret3"},
         "keyNS": {"test": "test"},
         "keyWCert": {"secret": "secret", "cert": "cert"},
     }
     store = LTIOAuthDataStore(consumers)
     self.assertEqual(store.lookup_consumer("key1").secret, "secret1")
     self.assertEqual(store.lookup_consumer("key2").secret, "secret2")
     self.assertEqual(store.lookup_consumer("key3").secret, "secret3")
     self.assertEqual(store.lookup_cert("keyWCert"), "cert")
     self.assertIsNone(store.lookup_consumer("key4"))
     self.assertIsNone(store.lookup_cert("key4"))
     self.assertIsNone(store.lookup_consumer("keyNS"))
     self.assertIsNone(store.lookup_cert("keyNS"))