コード例 #1
0
    def test_that_data_from_api_is_stored(self):
        cache = StepsCache()
        key_name = "my script"
        first_value = "step 1 1"
        second_value = "step 1 2"
        data = [first_value, second_value]
        encoded_data = {first_value: "encrypted_first_value", second_value: "encrypted_second_value"}
        cache.key_name = Mock(return_value=key_name)
        cache.get_steps_information = Mock(return_value=data)
        cache.encode = encode_mock(encoded_data)

        client = cache.get_redis_client()
        cache.add_script_steps_data(client)

        self.assertTrue(client.sismember(key_name, "encrypted_first_value"))
        self.assertTrue(client.sismember(key_name, "encrypted_second_value"))
コード例 #2
0
 def test_that_encode_text_using_md5(self):
     cache = StepsCache()
     text = "important text"
     encoded_text = cache.encode(text)
     self.assertEquals(encoded_text, 'encrypted_value')